简体   繁体   English

Socket.io事件列表

[英]List of Socket.io Events

Does anyone know what events are built-in in Socket.io ? 有谁知道Socket.io中内置了哪些事件
For example: connection , disconnect , join etc. 例如: connectiondisconnectjoin等。

Here is all I found in the official docs: 以下是我在官方文档中找到的所有内容:

Client-side events for socket.io object: socket.io对象的客户端事件:

  • connect . connect Fired upon a successful connection. 成功连接后被解雇。

  • connect_error . connect_error Fired upon a connection error. 因连接错误而被解雇。
    Parameters: 参数:
    • Object error object Object错误对象

  • connect_timeout . connect_timeout Fired upon a connection timeout. 在连接超时时触发。

  • reconnect . reconnect Fired upon a successful reconnection. 成功重新连接后被解雇。
    Parameters: 参数:
    • Number reconnection attempt number Number重新连接尝试号码

  • reconnect_attempt . reconnect_attempt Fired upon an attempt to reconnect. 试图重新连接时被解雇。

  • reconnecting . reconnecting Fired upon an attempt to reconnect. 试图重新连接时被解雇。
    Parameters: 参数:
    • Number reconnection attempt number Number重新连接尝试号码

  • reconnect_error . reconnect_error Fired upon a reconnection attempt error. 在重新连接尝试错误时触发。
    Parameters: 参数:
    • Object error object Object错误对象

  • reconnect_failed . reconnect_failed Fired when couldn't reconnect within reconnectionAttempts 在reconnectionAttempts内无法重新reconnectionAttempts时触发

Client-side events for socket object: socket对象的客户端事件:

  • connect . connect Fired upon connecting. 连接时被解雇。
  • error . error Fired upon a connection error 因连接错误而被解雇
    Parameters: 参数:
    • Object error data Object错误数据
  • disconnect . disconnect Fired upon a disconnection. 断开连接后被解雇。
  • reconnect . reconnect Fired upon a successful reconnection. 成功重新连接后被解雇。
    Parameters: 参数:
    • Number reconnection attempt number Number重新连接尝试号码
  • reconnect_attempt . reconnect_attempt Fired upon an attempt to reconnect. 试图重新连接时被解雇。
  • reconnecting . reconnecting Fired upon an attempt to reconnect. 试图重新连接时被解雇。
    Parameters: 参数:
    • Number reconnection attempt number Number重新连接尝试号码
  • reconnect_error . reconnect_error Fired upon a reconnection attempt error. 在重新连接尝试错误时触发。
    Parameters: 参数:
    • Object error object Object错误对象
  • reconnect_failed . reconnect_failed Fired when couldn't reconnect within reconnectionAttempts 在reconnectionAttempts内无法重新reconnectionAttempts时触发

Server-side events: 服务器端事件:

  • connection / connect . connection / connect Fired upon a connection. 连接时被解雇。
    Parameters: 参数:
    • Socket the incoming socket. Socket输入插座。

Edit: 编辑:

For the current version ( 1.3.4 ) the reconnect_attempt and reconnecting client-side events are synonyms. 对于当前版本( 1.3.4 ), reconnect_attemptreconnecting客户端事件是同义词。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM