vendredi 20 février 2015

How to listen all action in nodejs

I'd like to know if it's possible to have a nodejs event which is listening all action sent by nodejs without modifying the lib source.


For example, i've got 2 actions :



socket.on("login", function() { //do something });
socket.on("getUser", function() { //do something });


But if socket sent me an action except "login" or "getUser", i'd like to do something like this :



socket.on("actionUnknow", function() { socket.disconnect(); });


I've found some topics on stackoverflow with the same problem, but answers was to modify lib source and I don't want to do it.


Aucun commentaire:

Enregistrer un commentaire