Skip to content
New issue

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

Socket.io, https, and express continuous connect/disconnect loop #1253

Closed
m1sta opened this issue Jun 7, 2013 · 2 comments
Closed

Socket.io, https, and express continuous connect/disconnect loop #1253

m1sta opened this issue Jun 7, 2013 · 2 comments

Comments

@m1sta
Copy link

m1sta commented Jun 7, 2013

I'm trying to use socket.io, express, and https together on node. When socket.io connects it immediatley disconnects, re-connects again and loops. The problem can be re-created using the following code...

Server

var app = express();
var server = https.createServer(sslOptions, app)
var io = require('socket.io').listen(server);
app.use(express.static('./public'));
server.listen(port, function(){});

Client

<script type="text/javascript" src="/socket.io/socket.io.js"></script>
<script>
    var socket = io.connect('https://testdomain.com', { secure: true });
</script>

Error

debug - client authorized
info  - handshake authorized uBDQXqTmgbJzm-lnSWsm
debug - setting request GET /socket.io/1/websocket/uBDQXqTmgbJzm-lnSWsm
debug - set heartbeat interval for client uBDQXqTmgbJzm-lnSWsm
debug - client authorized for
debug - websocket writing 1::
warn  - websocket parser error: reserved fields must be empty
info  - transport end (undefined)
debug - set close timeout for client uBDQXqTmgbJzm-lnSWsm
debug - cleared close timeout for client uBDQXqTmgbJzm-lnSWsm
debug - cleared heartbeat interval for client uBDQXqTmgbJzm-lnSWsm
debug - discarding transport
@m1sta
Copy link
Author

m1sta commented Jun 7, 2013

I've noticed that when using https line 509 of hybi-16.js (Parser.prototype.processPacket) get's hit immediately after connection with the data parameter set to 129. This is where the error is thrown. With http, this line is doesn't appear to be hit until the first heartbeat, at which time the data parameter is set to 71 and all works fine.

@m1sta
Copy link
Author

m1sta commented Jun 8, 2013

Fixed by uninstalling Node v0.10.9 and installing v0.10.10.

@m1sta m1sta closed this as completed Jun 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant