I want to catch when any event, regardless of the name was sent from a socket. Is there some sort of wildcard I can use here for that?
io.on('connection', function (socket) {
socket.on('any event', function (data) {
...
});
});
I want to catch when any event, regardless of the name was sent from a socket. Is there some sort of wildcard I can use here for that?
io.on('connection', function (socket) {
socket.on('any event', function (data) {
...
});
});
you can use the wildcard plugin to listen to all events
http://socket.io/docs/faq/ https://github.com/hden/socketio-wildcard
u can use
socket.onAny((eventName, args...)=>{
//something
});
https://socket.io/docs/v4/listening-to-events/#socketonanylistener