diff --git a/client.go b/client.go index 2977c6a..52f3271 100644 --- a/client.go +++ b/client.go @@ -14,6 +14,7 @@ type Client interface { ID() string Conn() *websocket.Conn Path() string + run() } type client struct { @@ -34,8 +35,6 @@ func NewClient(id string, path string, o *ClientOptions, conn *websocket.Conn) C messageType: websocket.TextMessage, } - go c.run() - return c } diff --git a/server.go b/server.go index 62aa4a0..a0d173c 100644 --- a/server.go +++ b/server.go @@ -80,6 +80,8 @@ func (s *server) onConnection(ctx *fasthttp.RequestCtx) { s._cMtx.Unlock() s._option.OnConnection(c) + + c.run() }) }