You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am subscribing to the 'connect' and 'disconnect' events in my app controller, which stays in scope always. In the event of a socket disconnect, I'm displaying a 'reconnect' button (or I may do it on a timer), which reconnects successfully using $sails.connect(). Thing is, the 'connect' or 'reconnect' events are not fired this time. Any ideas why? Or how I can improve on this? I've tried accessing the _raw events also, but seems the same.
He's some simplified code...
vm.sailsState='disconnected';vm.reconnect=function(){$sails.connect();};$sails.on('connect',function(a,b){$log.log("Sails socket connected",a,b);vm.sailsState='connected';// This fires on initial connect, then never again});$sails.on('reconnect',function(a,b){$log.log("Sails socket reconnected",a,b);vm.sailsState='connected';// This never fires, not sure it should though});$sails.on('disconnect',function(a,b){$log.warn("Sails socket disconnected",$sails);vm.sailsState='disconnected';// This fires once first disconnect, then never again});
Also, am I right in thinking that auto-reconnect is forcibly disabled ? I guess so it doesn't keep trying to connect after scope is destroyed.
The text was updated successfully, but these errors were encountered:
Hi, I am subscribing to the 'connect' and 'disconnect' events in my app controller, which stays in scope always. In the event of a socket disconnect, I'm displaying a 'reconnect' button (or I may do it on a timer), which reconnects successfully using
$sails.connect()
. Thing is, the 'connect' or 'reconnect' events are not fired this time. Any ideas why? Or how I can improve on this? I've tried accessing the _raw events also, but seems the same.He's some simplified code...
Also, am I right in thinking that auto-reconnect is forcibly disabled ? I guess so it doesn't keep trying to connect after scope is destroyed.
The text was updated successfully, but these errors were encountered: