angular-socket-io icon indicating copy to clipboard operation
angular-socket-io copied to clipboard

how can i confirm the angular app is successful connected ?

Open ghost opened this issue 9 years ago • 1 comments

how to confirm the angular app is successful connected to some ip address ? please give some example code. thanks!

ghost avatar Aug 11 '16 09:08 ghost

if you log the socket object, it has 'disconnected' and 'connected' fields

so how about something like

var socket = io.connect(YOUR_URL);
if (socket.connected) console.log('connected!');

AzRu avatar Aug 16 '16 19:08 AzRu