How to use custom websockets[BUG]
- Dominant language
- Go
- Stars
- 25.6k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
```
app := iris.New()
appRouter := app.Party("/api")
appRouter.PartyFunc("/record", func(request router.Party) {
request.Any("/ws", hero.Handler(newRecordHandler.Ws))
})
```
```
var upgrader = websocket.Upgrader{
ReadBufferSize: 10240,
WriteBufferSize: 10240,
CheckOrigin: func(r *http.Request) bool {
return true
},
}
func (r *RecordHandler) Ws(ctx iris.Context) {
conn, _:= upgrader.Upgrade(ctx.ResponseWriter(), ctx.Request(), nil)
go func(){
err := conn.WriteMessage(websocket.TextMessage,[]byte("ok"))
//[HTTP Server] http: response.Write on hijacked connection from github.com/kataras/iris/v12/context.(*responseWriter).Write (response_writer.go:276)???
}()
for {
_, message, err := conn.ReadMessage()
//close 1006 (abnormal closure): unexpected EOF ????
}
}
```
How can I make it work properly
Contributor guide
Assessment
This issue has not been assessed yet.