aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go10
1 files changed, 8 insertions, 2 deletions
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