Configure TimeOut and Transports in Socket.IO 1.0

送分小仙女□ 提交于 2019-11-30 18:04:33

问题


In old versions of Socket.IO (< 0.9), I configured "close timeout" and "transports" this way:

io.set("transports", ["xhr-polling"]);
io.set("close timeout", 3);

But now, the command io.set has been deprecated. How do I define close timeout and transports?

When I use the old version this message appears:

Option close timeout is not valid.


回答1:


See the documentation here: http://socket.io/docs/migrating-from-0-9/#configuration-differences

Basically, you just have to set those when you initialize the server:

var socket = require('socket.io')({
  // options go here
});


来源:https://stackoverflow.com/questions/24685198/configure-timeout-and-transports-in-socket-io-1-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!