add boilerplate for message control
This commit is contained in:
parent
ffa426bf69
commit
3cf76b96df
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user