Hey folks Brief question regarding coder/websocket + Echo v5: Given that Echo executes every handler on a goroutine of its own, can I simply keep that goroutine occupied running the read loop — without adding go readPump()?


func (endpoint *SocketEndpoint) ServeSocket(ctx echo.Context) error {

socket, _ := websocket.Accept(ctx.Response(), ctx.Request(), nil)

defer socket.CloseNow()

for { _, message, readErr := socket.Read(ctx.Request().Context()) if readErr != nil { return nil } endpoint.bus.Publish(message) }


}

Since concurrent writes are managed inside coder/websocket, can the hub also use conn.Write() itself rather than having an additional writePump goroutine — would that arrangement be correct?