iris
iris copied to clipboard
Websocket handler inside a party
Is your feature request related to a problem? Please describe. i can not create a ws handler inside party
Describe the solution you'd like ws handler registered inside a party works
Describe alternatives you've considered I managed to register a handler at root level but with path nested as the party
Hello @ierehon1905, can you show us the code snippet you used to do it?
Hello,
The following code works (the ws handle)
app.Get("/api/ws", websocket.Handler(ws))
api := app.Party("/api")
{
api.Use(iris.Compression)
api.Get("/ping", pingHandler)
api.Post("/user-session", createUserSessionHandler)
api.Get("/game/:id", getGameHandler)
app.Get("/logout", logoutHandler)
}
The following does not
api := app.Party("/api")
{
api.Use(iris.Compression)
api.Get("/ping", pingHandler)
api.Post("/user-session", createUserSessionHandler)
api.Get("/game/:id", getGameHandler)
app.Get("/logout", logoutHandler)
app.Get("/ws", websocket.Handler(ws))
}
I use websocket.DefaultGobwasUpgrader
to enable CORS.