Hi There,
I find it hard to integrate a sockjs server (http://godoc.org/gopkg.in/igm/sockjs-go.v2/sockjs) as the handler return an http.Handler type.
Here's the initializer:
var messageHandler = sockjs.NewHandler("/api/messages", sockjs.DefaultOptions, func(session sockjs.Session) {
go func() {
receiveMessage(session)
}()
})
I can't just wrap it in a func (c *gin.Context)
so I guess there's probably another way..?
Thanks for help.
You can go to a lower level of the framework, please check this: #51
Thank you Javier!
For the sake of clarity for those interested:
func messageHandler(c *gin.Context) {
sockjsHandler := sockjs.NewHandler("/api/messages", sockjs.DefaultOptions, func(session sockjs.Session) {
go func() {
receiveMessage(session)
}()
})
sockjsHandler.ServeHTTP(c.Writer, c.Request)
}
@gplume great, to avoid future issues like this, I'll update the readme soon.
Most helpful comment
51 issue and example works perfectly.
Thank you Javier!
For the sake of clarity for those interested: