Replace ResultsCh with ResponsesCh

This commit is contained in:
Silas Davis
2017-10-24 17:38:12 +01:00
parent 01be6fa309
commit f6adddb4a8
5 changed files with 47 additions and 49 deletions

View File

@@ -318,16 +318,18 @@ func (w *WSEvents) redoSubscriptions() {
func (w *WSEvents) eventListener() {
for {
select {
case res := <-w.ws.ResultsCh:
case resp := <-w.ws.ResponsesCh:
// res is json.RawMessage
err := w.parseEvent(res)
if resp.Error != nil {
// FIXME: better logging/handling of errors??
fmt.Printf("ws err: %+v\n", resp.Error.Error())
continue
}
err := w.parseEvent(*resp.Result)
if err != nil {
// FIXME: better logging/handling of errors??
fmt.Printf("ws result: %+v\n", err)
}
case err := <-w.ws.ErrorsCh:
// FIXME: better logging/handling of errors??
fmt.Printf("ws err: %+v\n", err)
case <-w.quit:
// send a message so we can wait for the routine to exit
// before cleaning up the w.ws stuff