-
Notifications
You must be signed in to change notification settings - Fork 76
Internet Explorer incorrectly breaks off connection each 15 seconds, the server doesn't fulfill onClose event #33
Comments
Excuse me, but what did you do exactly? |
Sample server: date_default_timezone_set('UTC');
require_once "vendor/autoload.php";
if (!defined('HOA')) {
die("Failed start daemon: Hoa-socket lib not found");
}
// get unique client ID
function getClientId($bucket) {
return $bucket->getSource()->getConnection()->getCurrentNode()->getId();
}
// server run
$websocket = new Hoa\Websocket\Server(
new Hoa\Socket\Server('tcp://0.0.0.0:3333')
);
$websocket->on('open', function ( Hoa\Core\Event\Bucket $bucket ) {
echo 'new connection #', getClientId($bucket), "\n";
return;
});
$websocket->on('message', function ( Hoa\Core\Event\Bucket $bucket ) {
$data = $bucket->getData();
echo '> message ', $data['message'], "\n";
$bucket->getSource()->send($data['message']);
echo '< echo', "\n";
return;
});
$websocket->on('close', function ( Hoa\Core\Event\Bucket $bucket ) {
echo 'connection closed #', getClientId($bucket), "\n";
return;
});
$websocket->run(); Sample Client: <input type="text" id="input" placeholder="Message…" />
<hr />
<pre id="output"></pre>
<script>
function mySocketServer() {
var host = 'ws://fulledu.ru:3333';
var socket = null;
var input = document.getElementById('input');
var output = document.getElementById('output');
var print = function ( message ) {
var samp = document.createElement('samp');
samp.innerHTML = message + '\n';
output.appendChild(samp);
return;
};
input.addEventListener('keyup', function ( evt ) {
if(13 === evt.keyCode) {
var msg = input.value;
if(!msg)
return;
try {
socket.send(msg);
input.value = '';
input.focus();
}
catch ( e ) {
console.log(e);
}
return;
}
});
try {
socket = new WebSocket(host);
socket.onopen = function ( ) {
print('connection is opened');
input.focus();
return;
};
socket.onmessage = function ( msg ) {
print(msg.data);
return;
};
socket.onclose = function ( ) {
print('connection is closed');
setTimeout(function(){mySocketServer()}, 1000 * 2);
return;
};
}
catch ( e ) {
console.log(e);
}
}
mySocketServer();
</script> Result screenshot with Internet Explorer: onClose event not work... |
Which version of Internet Explorer are you using? |
I assign @camael24 on this one. He will try to reproduce. |
"Internet Explorer 11" The same bug can be reproduced if connection is broken off by the third party.
or etc.. |
Possibly it is other mistakes, for certain I can't tell. |
I try to reproduce tomorrow :) |
I confirm the "bug", i reproduce it on IE11 |
It is required that the event of onClose would work anyway if the client was disconnected from the server. |
It's going to be difficult to debug, I don't have Windows. Any idea how could I do that? |
With an VM ? and an demo key |
Perfect! Thanks. |
Here is what need to be considered. IE sends an unsollicited
Several implementations out there (Play, Spring, Go etc.) encountered this issue because receiving an unsollicited Since we don't respond, IE sends a random frame that is not a valid one. And yes, random, I don't receive the same frame twice. Because the bug is still opened on IE10, we can assume this is still present in IE11. I close this issue because I can't do anything to avoid that… The connection is closed by the server because of the malformed/invalid message we receive after the Sorry for that. If you find a server that handles IE11 properly, I would be glad to know them and look inside the code to see what workaround they found. |
No description provided.
The text was updated successfully, but these errors were encountered: