go-socket.io
go-socket.io copied to clipboard
working on js socket.io but not in this library
is there any way to handle any incoming emit message without defining emit type ?
i wonder, why this works :
io.on('connection', function (socket) {
console.log("incoming")
socket.on('test', function (data) {
console.log(data);
});
});
but not in Go version :
// OnConnect part are working
server.OnConnect("/", func(s socketio.Conn) error {
fmt.Println("connected:", s.ID())
return nil
})
server.OnEvent("/", "test", func(s socketio.Conn, msg string) {
fmt.Println(s.URL())
fmt.Println(s.Rooms())
fmt.Println(s.RemoteAddr())
fmt.Println(s.LocalAddr())
fmt.Println("notice:", msg)
})
can you post your client code / tell us the version of the client library you used?
i use https://github.com/socketio/socket.io-client-java
the code :
IO.Options opts = new IO.Options();
opts.reconnection = true;
opts.reconnectionDelay = 5000;
opts.reconnectionDelayMax = 999999999;
ioSocket = IO.socket("http://192.168.8.101:42474");
ioSocket.emit("test", "hello".getBytes())
@codenoid Do you can share simple working source code from java? What is your client library version?
@mrfoe7 1.0.0 , from README.md