2012-06-15 22 views

cevap

4

Tabii, orada örneklerle Socket.IO-istemci belgelerine ödeme: socket.io (1.3.x) mevcut sürümünde

https://github.com/LearnBoost/socket.io-client#sockets-for-the-rest-of-us

socket.on('connect', function() { 
    // socket connected 
}); 
+0

Ve bağlantı başarılı değilse? – birkof

+0

'connect_failed' olayını kontrol edin: https://github.com/LearnBoost/socket.io-client#events – alessioalex

+1

Örneğimde olduğu gibi görünüyor bu olay şu andan vazgeçmiyor :( – birkof

2

sen connect_error kullanabilirsiniz olay veya reconnect_failed olay:

var socket = io(serverUrl); 
socket.on('connect_error', function() { 
    console.log('Connection failed'); 
}); 
socket.on('reconnect_failed', function() { 
    console.log('Reconnection failed'); 
}); 

Bkz: https://github.com/Automattic/socket.io-client#events

İlgili konular