From ce9d9f8b2183bc0a31bfa40e780ae07182bc7cf8 Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 12 Jul 2026 14:09:36 +0200 Subject: added pubsub command registry --- main.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 9e48eb0..36a41b5 100644 --- a/main.go +++ b/main.go @@ -86,7 +86,13 @@ func handleConnection(conn net.Conn) { command := strings.ToUpper(args[0]) - conn.Write(core.SerializeRESP(commands.DispatchBaseCommand(db,command,args))) - + if cmd , ok := commands.PubSubRegistry[command]; ok { + commands.DispatchPubSub(conn, &hub, cmd, args) + } else if cmd, ok := commands.BaseRegistry[command]; ok { + res := commands.DispatchBaseCommand(db, cmd, args) + conn.Write(core.SerializeRESP(res)) + } else { + conn.Write(core.SerializeRESP(fmt.Errorf("ERR unknown command '%s'", command))) + } } } \ No newline at end of file -- cgit v1.2.3