janpantel / angular-sails

An angular module for using the sails socket.io api
MIT License
307 stars 56 forks source link

Custom function for On Reconnect socket #97

Open cschwaderer opened 8 years ago

cschwaderer commented 8 years ago

Using version 2.0.0-beta.3 of angular sails, I'd like to set up a custom function whenenever the connection/user socket is reconnected (e.g. after network problems).

But I don't know how to do that and whether it's possible at all.

Inside, angular-sails.js, I was able to run the lines of code below inside the SailsIo.prototype.connect function:

self.on('reconnect', function(attemps) { console.log("Foooo"); });

But of course, that's not where such a function should be put. So, how can I put that into my own code?

cschwaderer commented 8 years ago

Well, I think it's simply

$sails.on('reconnect', function(attemps) { console.log("Foooo"); }

So, please forget about that stupid question. I was confused by my own code.