googollee / go-socket.io

socket.io library for golang, a realtime application framework.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

v1.6.1 or above sends events in the OnConnect() method, but the client cannot receive the message.

HybgerFinance opened this issue · comments

commented

v1.6.1 and above: v1.6.2, v1.6.3, v1.7.0, v1.8.0-rc.1

opts := &engineio.Options{
PingTimeout: 10 * time.Second,
PingInterval: 1 * time.Second,
}
server := socketio.NewServer(opts)

server.OnConnect("/", func(s socketio.Conn) error {
params, _ := url.ParseQuery(s.URL().RawQuery)
uid := params.Get("uid")
s.Join("test")
s.Emit("logined", "Logged in successfully") #For above versions, the client cannot receive the message notification with this method.
server.BroadcastToRoom("/", "test", "userInfo", "zhangsan") #In above versions, the client cannot receive message notifications with this method
}