Not working OnEvent Method
hktalent opened this issue · comments
client
<script src="https://cdn.socket.io/socket.io-1.2.0.js"></script>signaling_socket = io({query: {room:ROOM_ID, userId:szUserId}, withCredentials: true,transports:aT1});
signaling_socket.on('connect', function () {
join_chat_channel(ROOM_ID, {userId:szUserId});// is ok run
});
function join_chat_channel(channel, userdata) {
signaling_socket.emit('join', { "channel": channel, "userdata": userdata });// run is ok in client
}
server
server.OnConnect(x1, fnConn(x1))
// not work on join
server.OnEvent(x1, "join", join)
I think it may be necessary to bind events to conn
server.OnConnect(x1, func(conn socketio.Conn) error{
conn.OnEvent(x1, "join", join)
return nil
})