socket.io-redux icon indicating copy to clipboard operation
socket.io-redux copied to clipboard

How do you receive messages?

Open designbyadrian opened this issue 8 years ago • 3 comments
trafficstars

Having all messages being dispatched as actions would be good.

Having connected and disconnected actions as well would be ideal.

designbyadrian avatar Aug 21 '17 13:08 designbyadrian

@designbyadrian did you manage to implement it?

patrickmuhi avatar Dec 02 '17 22:12 patrickmuhi

The middleware is used to emit actions, to receive messages you need to save the connection to a constant before passing it to the middleware and then use socket.on('action', store.dispatch) (or anything you want to do with the action).

I recommend you to remove the action.meta.socket key on your server to avoid the middleware emitting them again.

sergiodxa avatar Dec 02 '17 22:12 sergiodxa

@sergiodxa wubba lubba dub dub 🙏💯

patrickmuhi avatar Dec 03 '17 20:12 patrickmuhi