0中配置超时和传输

0中配置超时和传输

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

问题描述

在Socket.IO的旧版本(

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:

推荐答案

在此处查看文档: 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中配置超时和传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 20:13