Janith
Janith

Reputation: 2910

Get Messages from any channel using Socket.io

Is there a way to get messages which could be receiving in any channel in socket.io like plain web-sockets, something like,

socket.on('*' , (data) => {})

Upvotes: 0

Views: 86

Answers (1)

pshenkyr
pshenkyr

Reputation: 26

Socket.io doesn't handle it natively but someone wrote a middleware to handle wildcards: https://github.com/hden/socketio-wildcard

Example from the Readme:

io.on('connection', (socket) => {
  socket.use((packet, next) => {
    // Handler
    next();
  });
});

Upvotes: 1

Related Questions