keep connected && transport error handler#2
keep connected && transport error handler#2cravler wants to merge 4 commits intothesyncim:masterfrom
Conversation
cravler
commented
Sep 17, 2018
|
Thanks for your interest in this project. I'am Ok to extend the client interface with OnTransportError(this should be pretty useful in mobile devices). Also, be aware that i'm probably going to break some API like thank you! |
| return nil | ||
| } | ||
|
|
||
| func (w *Websocket) readWorker() error { |
There was a problem hiding this comment.
keep the current function signature
transport/websocket/websocket.go
Outdated
| select { | ||
| case err := <-w.stopCh: | ||
| return err | ||
| panic(err) |
There was a problem hiding this comment.
please do not panic in user libraries, I'm sure you don't want to panic when you disconnect the client (see w.stopCh)
transport/websocket/websocket.go
Outdated
| err := w.conn.ReadJSON(&payload) | ||
| if err != nil { | ||
| return err | ||
| panic(err) |
There was a problem hiding this comment.
do not panic if the read fail, FAYE protocol should handle auto-reconnect( this is going to be handled in the upcoming commits )
| if transport.IsMetaMessage(msg) { | ||
| //handle it | ||
| switch msg.Channel { | ||
| case transport.MetaConnect: |
There was a problem hiding this comment.
this is going to be handled in the upcoming commits as well, we shouldn't reconnect always.
If the server sends advise.reconnect==none we should stop
|
I understood that work in progress and there are might be breaking changes, but thanks for explanations. |