socketio / socket.io-adapter

The Socket.IO in-memory adapter
https://socket.io/
197 stars 101 forks source link

Adapter doesn't call middleware function #62

Closed ondrej-111 closed 4 years ago

ondrej-111 commented 4 years ago

I am using socket.io-redis adapter for REDIS sub/pub feature and socket.io-emitter which broadcast data out of of socket.io process. On connection new socket it register middleware like this:

socket.use((packet: Packet, next: (err?: any) => void) => {
                console.log('SOCKET MIDDLEWARE INVOKED');
                next();
            });

but on broadcasting data this middleware is not called... I investigate that socket.io-redis lib is calling socket.io-adapter to broadcast data but this broadcast doesn't invoke middlewares like I expected. I appreciate any help :)