I'm using https://github.com/googollee/go-socket.io to create a socket.io server. I'm trying to create a namespace, but I'm not able to connect to the namespace from the client side.
Server:
func registerHandlers(server *socketio.Server) {
server.Of("room1").On("connection", connectionHandler)
}
func connectionHandler(so socketio.Socket) {
log.Println("on connection")
so.Join("chat")
so.On("chat message", func(msg string) {
so.BroadcastTo("chat", "chat message", msg)
})
}
Client:
var socket = io.connect("http://localhost:3000/room1");
socket.on('chat message', function(msg){
$('#messages').append($('<li>').text(msg));
});
Am I missing something?