We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I add this(see below) in the chat example to send a disconnect from the client.
You have to use xhr-polling for this test
var connectedUrl = "";
socket.on('connect', function () { $('#chat').addClass('connected'); console.log(this.socket.transports);
$.each(this.socket.transports, function(index, item){ $("#transport").append(new Option(item, item)); }); console.log(this.socket.options.resource); console.log(this.socket.transport.name); console.log(this.socket.sessionid); console.log(io.protocol); //connectedUrl = document.location.protocol + "://" + document.location.host + "/" + this.socket.options.resource + "/" + io.protocol + "/" + this.socket.transport.name + "/" + this.socket.sessionid; connectedUrl = "/" + this.socket.options.resource + "/" + io.protocol + "/" + this.socket.transport.name + "/" + this.socket.sessionid; var getDisconnectURL = connectedUrl + "/?t="+ +new Date + "&disconnect"; console.log(getDisconnectURL);
});
$("#manualDisconnectGet").bind("click", function(){ var getDisconnectURL = connectedUrl + "?t="+ +new Date + "&disconnect";
$.get(getDisconnectURL, function(data) { //$('.result').html(data); alert('Load was performed.' +data); }); }); $("#manualDisconnectPost").bind("click", function(){ var getDisconnectURL = connectedUrl; $.post(getDisconnectURL, "0:::", function(data) { alert("Data Loaded: " + data); }); });
<div id="manualDisconnectPost">Force Disconnect with Post</div> </div>
background:yellow;
height: 30px; left: 0; top: 0; text-align: center; width: 150px; font: 15px Georgia; color: #666; }
background:green;
and I received that in my log if a try with a GET
1322726785 (3379512509903672): Start 'close_timer' (15) 1322726785 (3379512509903672): Event 'on_write' 1322726785 (3379512509903672): Staging '5:::{"args":[],"name":"disconnect"}' 1322726790 (3379512509903672): Send heartbeat 1322726790 (3379512509903672): Stop 'close_timer' 1322726790 (3379512509903672): Start 'close_timer' (15) 1322726790 (3379512509903672): Event 'on_write' 1322726790 (3379512509903672): Staging '2::' 1322726793 (2664053128490294): Send heartbeat 1322726793 (2664053128490294): Stop 'close_timer' 1322726793 (2664053128490294): Start 'close_timer' (15) 1322726793 (2664053128490294): Event 'on_write' 1322726793 (2664053128490294): Staging '2::' 1322726800 (3379512509903672): Send heartbeat
... it doesn't stop.
with a POST I'll never received a disconnect event.
1322726905 (2888142389001222): Start 'close_timer' (15) 1322726908 (2888142389001222): Received '0:::' 1322726908 (2888142389001222): Stop 'close_timer' 1322726908 (2888142389001222): Start 'close_timer' (15) 127.0.0.1 - - [01/Dec/2011:00:08:28 -0800] "POST /socket.io/1/xhr-polling/2888142389001222 HTTP/1.1" 200 1 "http://localhost:5000/chat.html" "Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1" 1322726913 (2664053128490294): Send heartbeat 1322726913 (2664053128490294): Stop 'close_timer' 1322726913 (2664053128490294): Start 'close_timer' (15) 1322726913 (2664053128490294): Event 'on_write' 1322726913 (2664053128490294): Staging '2::' 1322726915 (2888142389001222): Send heartbeat 1322726915 (2888142389001222): Stop 'close_timer' 1322726915 (2888142389001222): Start 'close_timer' (15) 1322726915 (2888142389001222): Event 'on_write' 1322726915 (2888142389001222): Writing '2::' 1322726915 (2888142389001222): Emitting 'on_write' 1322726915 (2888142389001222): State 'reconnecting' 1322726915 (2888142389001222): Stop 'close_timer' 1322726915 (2888142389001222): Start 'reconnect_timer' (15) 1322726915 (2888142389001222): Received '2::' 1322726915 (2888142389001222): Stop 'close_timer' 1322726915 (2888142389001222): Start 'close_timer' (15) 127.0.0.1 - - [01/Dec/2011:00:08:35 -0800] "POST /socket.io/1/xhr-polling/2888142389001222?t=1322726915458 HTTP/1.1" 200 1 "http://localhost:5000/chat.html" "Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1" 1322726915 (2888142389001222): State 'reconnected' 1322726915 (2888142389001222): Stop 'reconnect_timer' 1322726915 (2888142389001222): Emitting 'on_reconnect' 1322726915 (2888142389001222): Start 'close_timer' (15) 1322726923 (2664053128490294): Send heartbeat 1322726923 (2664053128490294): Stop 'close_timer' 1322726923 (2664053128490294): Start 'close_timer' (15) 1322726923 (2664053128490294): Event 'on_write' 1322726923 (2664053128490294): Staging '2::' 1322726925 (2888142389001222): Send heartbeat 1322726925 (2888142389001222): Stop 'close_timer' 1322726925 (2888142389001222): Start 'close_timer' (15) 1322726925 (2888142389001222): Event 'on_write' 1322726925 (2888142389001222): Writing '2::' 1322726925 (2888142389001222): Emitting 'on_write' 1322726925 (2888142389001222): State 'reconnecting' 1322726925 (2888142389001222): Stop 'close_timer'
The text was updated successfully, but these errors were encountered:
Yes, this is not yet implemented. Working on it.
Sorry, something went wrong.
Btw, why don't you use socket.disconnect() directly?
I was testing socket.io's protocol.
To test the .disconnect, I use a select with onChange
$("#transport").change( function() { socket.disconnect(); // voir pull request 343 : socketio/socket.io-client#343 //socket = io.connect(); io.j = []; io.sockets = []; socket = io.connect();
No branches or pull requests
I add this(see below) in the chat example to send a disconnect from the client.
You have to use xhr-polling for this test
var connectedUrl = "";
socket.on('connect', function () {
$('#chat').addClass('connected');
console.log(this.socket.transports);
});
$("#manualDisconnectGet").bind("click", function(){
var getDisconnectURL = connectedUrl + "?t="+ +new Date + "&disconnect";
manualDisconnectGet {
height: 30px;
left: 0;
top: 0;
text-align: center;
width: 150px;
font: 15px Georgia;
color: #666;
}
manualDisconnectPost {
height: 30px;
left: 0;
top: 0;
text-align: center;
width: 150px;
font: 15px Georgia;
color: #666;
}
and I received that in my log if a try with a GET
1322726785 (3379512509903672): Start 'close_timer' (15)
1322726785 (3379512509903672): Event 'on_write'
1322726785 (3379512509903672): Staging '5:::{"args":[],"name":"disconnect"}'
1322726790 (3379512509903672): Send heartbeat
1322726790 (3379512509903672): Stop 'close_timer'
1322726790 (3379512509903672): Start 'close_timer' (15)
1322726790 (3379512509903672): Event 'on_write'
1322726790 (3379512509903672): Staging '2::'
1322726793 (2664053128490294): Send heartbeat
1322726793 (2664053128490294): Stop 'close_timer'
1322726793 (2664053128490294): Start 'close_timer' (15)
1322726793 (2664053128490294): Event 'on_write'
1322726793 (2664053128490294): Staging '2::'
1322726800 (3379512509903672): Send heartbeat
... it doesn't stop.
with a POST I'll never received a disconnect event.
1322726905 (2888142389001222): Start 'close_timer' (15)
1322726908 (2888142389001222): Received '0:::'
1322726908 (2888142389001222): Stop 'close_timer'
1322726908 (2888142389001222): Start 'close_timer' (15)
127.0.0.1 - - [01/Dec/2011:00:08:28 -0800] "POST /socket.io/1/xhr-polling/2888142389001222 HTTP/1.1" 200 1 "http://localhost:5000/chat.html" "Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
1322726913 (2664053128490294): Send heartbeat
1322726913 (2664053128490294): Stop 'close_timer'
1322726913 (2664053128490294): Start 'close_timer' (15)
1322726913 (2664053128490294): Event 'on_write'
1322726913 (2664053128490294): Staging '2::'
1322726915 (2888142389001222): Send heartbeat
1322726915 (2888142389001222): Stop 'close_timer'
1322726915 (2888142389001222): Start 'close_timer' (15)
1322726915 (2888142389001222): Event 'on_write'
1322726915 (2888142389001222): Writing '2::'
1322726915 (2888142389001222): Emitting 'on_write'
1322726915 (2888142389001222): State 'reconnecting'
1322726915 (2888142389001222): Stop 'close_timer'
1322726915 (2888142389001222): Start 'reconnect_timer' (15)
1322726915 (2888142389001222): Received '2::'
1322726915 (2888142389001222): Stop 'close_timer'
1322726915 (2888142389001222): Start 'close_timer' (15)
127.0.0.1 - - [01/Dec/2011:00:08:35 -0800] "POST /socket.io/1/xhr-polling/2888142389001222?t=1322726915458 HTTP/1.1" 200 1 "http://localhost:5000/chat.html" "Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
1322726915 (2888142389001222): State 'reconnected'
1322726915 (2888142389001222): Stop 'reconnect_timer'
1322726915 (2888142389001222): Emitting 'on_reconnect'
1322726915 (2888142389001222): Start 'close_timer' (15)
1322726923 (2664053128490294): Send heartbeat
1322726923 (2664053128490294): Stop 'close_timer'
1322726923 (2664053128490294): Start 'close_timer' (15)
1322726923 (2664053128490294): Event 'on_write'
1322726923 (2664053128490294): Staging '2::'
1322726925 (2888142389001222): Send heartbeat
1322726925 (2888142389001222): Stop 'close_timer'
1322726925 (2888142389001222): Start 'close_timer' (15)
1322726925 (2888142389001222): Event 'on_write'
1322726925 (2888142389001222): Writing '2::'
1322726925 (2888142389001222): Emitting 'on_write'
1322726925 (2888142389001222): State 'reconnecting'
1322726925 (2888142389001222): Stop 'close_timer'
The text was updated successfully, but these errors were encountered: