fasthttp-contrib / websocket

Websocket support for fasthttp
31 stars 10 forks source link

Return connection #2

Open dink10 opened 6 years ago

dink10 commented 6 years ago

I look at your code. And find it wonderful. But I think it would be better to return not only error from upgrader.Upgrade(ctx) but also connnection. It can helps create every time new connections and work with messages by topic. Also it could be compatible with original idea of "github.com/gorilla/websocket". How do you think?

func myChatHandler(ctx *fasthttp.RequestCtx) { err := upgrader.Upgrade(ctx)// returns only error, executes the handler you defined on the websocket.New before (the 'chat' function) }

daskol commented 6 years ago

I have actually the same issue. Now it is impossible to match both requst context object and connection object.