socket.io
socket.io copied to clipboard
Emit to room not work with uWebsocketjs
Describe the bug Emit some message to room not work with uWebsocketjs, but clients does`t got any message. To Reproduce
Please fill the following code example:
Socket.IO server version: x.y.z
Server
import { Server as socket_server } from 'socket.io';
import { App } from 'uWebSockets.js';
const uapp = App();
const socket_instance = new socket_server({
path: '/socket',
});
socket_instance.attachApp(uapp);
socket_instance.use((scoket, next) => {
console.log('socket connect >>>', scoket.id);
scoket.join('test');
setTimeout(() => {
console.log('socket emit >>>', scoket.rooms);
socket_instance.to('test').emit('message', 'hello world');
}, 2000);
return next();
});
uapp.listen(9999, (token) => {
console.log(token);
console.log('server is listening on port 8888');
});
Socket.IO client version: x.y.z
Client
import { io } from 'socket.io-client';
const client = io('http://localhost:9999', {
path: '/socket',
transports: ['websocket'],
});
client.onAny((...arg) => {
console.log('onany >>>', arg);
});
client.connect();
Expected behavior A clear and concise description of what you expected to happen.
Platform:
- Device: [e.g. Samsung S8]
- OS: [e.g. Android 9.2]
Additional context Socket.io & Socket.io-client 4.7.5 uWebsocketjs 20.44.0