stop reconnect, if the server sends advise.reconnect==none
This commit is contained in:
parent
c45cd2a7b3
commit
e46ce92706
@ -86,6 +86,10 @@ func (w *Websocket) readWorker() error {
|
|||||||
//handle it
|
//handle it
|
||||||
switch msg.Channel {
|
switch msg.Channel {
|
||||||
case transport.MetaConnect:
|
case transport.MetaConnect:
|
||||||
|
advise := w.advice.Load().(*message.Advise)
|
||||||
|
if advise.Reconnect == message.ReconnectNone {
|
||||||
|
return w.Disconnect()
|
||||||
|
}
|
||||||
m := message.Message{
|
m := message.Message{
|
||||||
Channel: transport.MetaConnect,
|
Channel: transport.MetaConnect,
|
||||||
ClientId: w.clientID,
|
ClientId: w.clientID,
|
||||||
@ -251,8 +255,9 @@ func (w *Websocket) Connect() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
go func () {
|
go func () {
|
||||||
err := w.readWorker()
|
if err := w.readWorker(); err != nil {
|
||||||
w.onError(err)
|
w.onError(err)
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
return w.sendMessage(&m)
|
return w.sendMessage(&m)
|
||||||
|
Loading…
Reference in New Issue
Block a user