Compare commits

..

No commits in common. "master" and "v1.3.0" have entirely different histories.

View file

@ -33,7 +33,6 @@ type ZelloClient struct {
// Event Chans
GeneralEventChan chan ZelloResponsePacked
BinaryDataChan chan []byte
ErrorEventChan chan error
}
func NewZelloClient() (zelloClient *ZelloClient) {
@ -44,7 +43,6 @@ func NewZelloClient() (zelloClient *ZelloClient) {
DefaultTimeout: time.Millisecond * 1e3,
SeqResponseChans: make(map[int64]chan map[string]interface{}),
GeneralEventChan: make(chan ZelloResponsePacked),
ErrorEventChan: make(chan error),
BinaryDataChan: make(chan []byte),
}
}
@ -486,26 +484,25 @@ func (zc *ZelloClient) handleRXbinary(data []byte) (err error) {
return nil
}
func (zc *ZelloClient) Work() (err error) {
func (zc *ZelloClient) Work() {
for {
msgType, message, err := zc.Connection.ReadMessage()
if err != nil {
//log.Println("read:", err)
zc.ErrorEventChan <- err
return err
log.Println("read:", err)
return
}
if msgType == websocket.TextMessage {
err = zc.handleRXjson(message)
if err != nil {
log.Println("handleRXjson:", err)
return err
return
}
}
if msgType == websocket.BinaryMessage {
err = zc.handleRXbinary(message)
if err != nil {
log.Println("handleRXbinary:", err)
return err
return
}
}
}