Skip to content

Commit

Permalink
dont use goroutine for every ws frame (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
riaan53 authored and adshao committed Oct 12, 2018
1 parent 2ea7818 commit e9a4ac0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions websocket.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package binance

import (
"github.com/gorilla/websocket"
"time"

"github.com/gorilla/websocket"
)

// WsHandler handle raw websocket message
Expand Down Expand Up @@ -47,10 +48,10 @@ var wsServe = func(cfg *wsConfig, handler WsHandler, errHandler ErrHandler) (don
default:
_, message, err := c.ReadMessage()
if err != nil {
go errHandler(err)
errHandler(err)
return
}
go handler(message)
handler(message)
}
}
}()
Expand Down

0 comments on commit e9a4ac0

Please sign in to comment.