【问题标题】:Configure TimeOut and Transports in Socket.IO 1.0在 Socket.IO 1.0 中配置超时和传输
【发布时间】:2014-09-01 08:08:38
【问题描述】:

在旧版本的 Socket.IO (

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

但现在,io.set 命令已被弃用。如何定义close timeouttransports

当我使用旧版本时,会出现此消息:

选项关闭超时无效。

【问题讨论】:

    标签: node.js socket.io socket.io-1.0


    【解决方案1】:

    在此处查看文档:http://socket.io/docs/migrating-from-0-9/#configuration-differences

    基本上,您只需要在初始化服务器时进行设置:

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

    【讨论】:

    • 但是如果socket连接到http或express服务器,如何配置?
    猜你喜欢
    • 2014-12-15
    • 2014-11-19
    • 2015-02-17
    • 2012-12-29
    • 1970-01-01
    • 2011-12-01
    • 1970-01-01
    • 2016-06-11
    • 2012-02-22
    相关资源
    最近更新 更多