在Socket.IO 1.0中配置超时和传输 [英] Configure TimeOut and Transports in Socket.IO 1.0

查看:259
本文介绍了在Socket.IO 1.0中配置超时和传输的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Socket.IO的旧版本(<0.9)中,我通过以下方式配置关闭超时"和传输":

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);

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

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.

推荐答案

在此处查看文档: 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
});

这篇关于在Socket.IO 1.0中配置超时和传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆