Socket.io 事件列表 [英] List of Socket.io Events

查看:29
本文介绍了Socket.io 事件列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道Socket.io中内置了哪些事件?
例如:connectiondisconnectjoin

Does anyone know what events are built-in in Socket.io?
For example: connection, disconnect, join etc.

推荐答案

以下是我在官方文档中找到的所有内容:

Here is all I found in the official docs:

客户端事件code>socket.io 对象:

  • 连接.在成功连接时触发.

  • connect_error.在连接错误时触发.
    参数:
    • Object 错误对象

    • connect. Fired upon a successful connection.

    • connect_error. Fired upon a connection error.
      Parameters:
      • Object error object

      • 号码 重新连接尝试号码

      • 号码 重新连接尝试号码

      • Object 错误对象

      socket 对象的客户端事件:

      • 连接.连接时触发.
      • 错误.在连接错误时触发
        参数:
        • Object 错误数据
        • connect. Fired upon connecting.
        • error. Fired upon a connection error
          Parameters:
          • Object error data
          • Number 重连尝试次数
          • Number reconnection attempt number
          • Number 重连尝试次数
          • Number reconnection attempt number
          • Object 错误对象

          服务器端事件:

          • connection/connect.在连接时触发.
            参数:
            • Socket 传入的套接字.
            • connection / connect. Fired upon a connection.
              Parameters:
              • Socket the incoming socket.

              对于当前版本 (1.3.4),reconnect_attemptreconnecting客户端事件是同义词.

              For the current version (1.3.4) the reconnect_attempt and reconnecting client-side events are synonyms.

              这篇关于Socket.io 事件列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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