node.js Socket.io 事件列表
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24224287/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 17:28:32 来源:igfitidea点击:
List of Socket.io Events
提问by Abhishek Kaushik
Does anyone know what eventsare built-in in Socket.io?
For example: connection, disconnect, joinetc.
有谁知道Socket.io中内置了哪些事件?
例如:,,等。connectiondisconnectjoin
回答by Oleg
Here is all I found in the official docs:
这是我在官方文档中找到的所有内容:
Client-side events for socket.ioobject:
socket.io对象的客户端事件:
connect. Fired upon a successful connection.connect_error. Fired upon a connection error.
Parameters:Objecterror object
connect_timeout. Fired upon a connection timeout.reconnect. Fired upon a successful reconnection.
Parameters:Numberreconnection attempt number
reconnect_attempt. Fired upon an attempt to reconnect.reconnecting. Fired upon an attempt to reconnect.
Parameters:Numberreconnection attempt number
reconnect_error. Fired upon a reconnection attempt error.
Parameters:Objecterror object
reconnect_failed. Fired when couldn't reconnect withinreconnectionAttempts
connect. 连接成功时触发。connect_error. 在连接错误时触发。
参数:Object错误对象
connect_timeout. 在连接超时时触发。reconnect. 在成功重新连接时触发。
参数:Number重连尝试次数
reconnect_attempt. 在尝试重新连接时触发。reconnecting. 在尝试重新连接时触发。
参数:Number重连尝试次数
reconnect_error. 在重新连接尝试错误时触发。
参数:Object错误对象
reconnect_failed. 在无法重新连接时触发reconnectionAttempts
Client-side events for socketobject:
socket对象的客户端事件:
connect. Fired upon connecting.error. Fired upon a connection error
Parameters:Objecterror data
disconnect. Fired upon a disconnection.reconnect. Fired upon a successful reconnection.
Parameters:Numberreconnection attempt number
reconnect_attempt. Fired upon an attempt to reconnect.reconnecting. Fired upon an attempt to reconnect.
Parameters:Numberreconnection attempt number
reconnect_error. Fired upon a reconnection attempt error.
Parameters:Objecterror object
reconnect_failed. Fired when couldn't reconnect withinreconnectionAttempts
connect. 连接时触发。error. 连接错误时触发
参数:Object错误数据
disconnect. 断开连接时触发。reconnect. 在成功重新连接时触发。
参数:Number重连尝试次数
reconnect_attempt. 在尝试重新连接时触发。reconnecting. 在尝试重新连接时触发。
参数:Number重连尝试次数
reconnect_error. 在重新连接尝试错误时触发。
参数:Object错误对象
reconnect_failed. 在无法重新连接时触发reconnectionAttempts
Server-side events:
服务器端事件:
connection/connect. Fired upon a connection.
Parameters:Socketthe incoming socket.
connection/connect. 在连接时触发。
参数:Socket传入的套接字。
Edit:
编辑:
For the current version (1.3.4) the reconnect_attemptand reconnectingclient-side events are synonyms.
对于当前版本 ( 1.3.4)reconnect_attempt和reconnecting客户端事件是同义词。

