Skip to content

Instantly share code, notes, and snippets.

@neino3
Created August 14, 2012 02:17
Show Gist options
  • Save neino3/3345788 to your computer and use it in GitHub Desktop.
Save neino3/3345788 to your computer and use it in GitHub Desktop.
----index.html-----
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>htmlfile post test on IE6</title>
</head>
<body>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script type="text/javascript">
$(function() {
var socket = io.connect();
socket.on('connect', function() {
$('#status').append('::connect::');
$('#transport').append(socket.socket.transport.name);
});
socket.on('disconnect', function (reason) {
$('#status').append('->disconnect');
});
$('#hello').click(function() {
// from the second time, always buffered.
socket.send('hello');
});
});
</script>
<div id="button">
<input type="button" id="hello" value="hello" />
</div>
Status: <div id="status"></div>
Transport: <div id="transport"></div>
<hr>
<b>Problem</b>
<br>I expect each time I click "hello" button, a server console displays "receive:hello".
<br>First click is OK. But from the second time, a console doesn't display.
<br>This problem can only be seen on IE6 with transport "htmlfile".
<br>Pull request is<a href="https://github.com/LearnBoost/socket.io-client/pull/459">here</a>
<hr>
I found this on a following environment.
<ul>
<li>OS: Windows XP SP3</li>
<li>browser: IE6
<li>node: 0.8.6
<li>socket.io: 0.9.10
<li>transport: htmlfile
</ul>
</body>
</html>
----server.js-----
var app = require('express').createServer();
var listen_port = 8080;
var net = require('net');
var io = require('socket.io').listen(app);
app.listen(listen_port);
console.log('server listening on ' + listen_port);
app.get('/', function (req, res) {
res.sendfile(__dirname + '/index.html');
});
app.get('/jquery.min.js', function (req, res) {
res.sendfile(__dirname + '/jquery.min.js');
});
io.sockets.on('connection', function(socket) {
console.info('connected: ' + socket.id + ' by ' + socket.transport);
socket.on('message', function(msg) {
console.info('receive:' + msg);
});
socket.on('disconnect', function(reason) {
console.log('disconnected');
});
});
----package.json-----
{
"name": "htmlfile_on_IE6"
, "version": "0.0.1"
, "private": true
, "dependencies": {
"express": "2.5.x"
, "socket.io": "0.9.10"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment