node.js - Socket.io 1.0 : configure close timeout -
how can configure alternative 'close timeout' code below ?
var app = require('express')(); var server = require('http').server(app); var io = require('socket.io')(server); ... server.listen(port, ip);
i read doc socket.io , found :
var socket = require('socket.io')({ // options go here });
but can't add together options because i'm using server
variable.
thanks.
have seen this ?
var io = require('socket.io').listen(80); io.set('close timeout', 60); io.set('heartbeat timeout', 60);
maybe like
var app = require('express')(); var server = require('http').server(app); var io = require('socket.io')(server); io.set('close timeout', 60); server.listen(port, ip);
edit: long shot but:
var app = require('express')(); var server = require('http').server(app); server['close timeout'] = 60; var io = require('socket.io')(server); server.listen(port, ip);
edit: found on socket.io docs:
// pass server , `serveclient` alternative var io = require('socket.io')(http, { serveclient: false });
so, this?
var app = require('express')(); var server = require('http').server(app); var io = require('socket.io')(server, { 'close timeout': 60}); server.listen(port, ip);
yet edit: in docs again:
the same options passed socket.io passed engine.io server gets created. see engine.io options reference.
pingtimeout (number): how many ms without pong packet consider connection closed (60000)
can seek this?
var app = require('express')(); var server = require('http').server(app); var io = require('socket.io')(server, { pingtimeout: 60000}); server.listen(port, ip);
node.js sockets io socket.io
No comments:
Post a Comment