Seems socket.Server.Emit not work?
Closed this issue · 2 comments
funte commented
Expected:
The postman client should get "server hello..." message but not.
Reproduce code:
package main
import (
"net/http"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"github.com/zishang520/socket.io/v2/socket"
)
func main() {
var r = chi.NewRouter()
r.Use(middleware.Heartbeat("/ping"))
var server = socket.NewServer(nil, nil)
server.On("connection", func(clients ...any) {
var client = clients[0].(*socket.Socket)
client.Emit("welcome", "client hello...")
server.Emit("welcome", "server hello...")
server.Of("/", nil).Emit("welcome", "root room hello...")
})
r.Handle("/socket.io/", server.ServeHandler(nil))
http.ListenAndServe("localhost:8080", r)
}
zishang520 commented
Waiting for my survey results.
zishang520 commented