add boilerplate for message control

This commit is contained in:
Marcelo Pires 2018-09-05 15:23:03 +02:00
parent ffa426bf69
commit 3cf76b96df

View File

@ -63,9 +63,25 @@ func (w *Websocket) readWorker() error {
msg := payload[0]
if transport.IsControlMsg(msg.Channel) {
//handle it
log.Println("recv control message", debugJson(msg))
//handle it
switch msg.Channel {
case transport.Subscribe:
//handle Subscribe resp
case transport.Unsubscribe:
//handle Unsubscribe resp
case transport.Connect:
//handle Connect resp
case transport.Disconnect:
//handle Disconnect resp
case transport.Handshake:
//handle Handshake resp
}
continue
}
@ -77,7 +93,6 @@ func (w *Websocket) readWorker() error {
subscription <- &msg
}
}
}
func (w *Websocket) Name() string {