Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
420 views
in Technique[技术] by (71.8m points)

node.js - List of Socket.io Events

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Here is all I found in the official docs:

Client-side events for socket.io object:

  • connect. Fired upon a successful connection.

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

  • connect_timeout. Fired upon a connection timeout.

  • reconnect. Fired upon a successful reconnection.
    Parameters:
    • Number reconnection attempt number

  • reconnect_attempt. Fired upon an attempt to reconnect.

  • reconnecting. Fired upon an attempt to reconnect.
    Parameters:
    • Number reconnection attempt number

  • reconnect_error. Fired upon a reconnection attempt error.
    Parameters:
    • Object error object

  • reconnect_failed. Fired when couldn’t reconnect within reconnectionAttempts

Client-side events for socket object:

  • connect. Fired upon connecting.
  • error. Fired upon a connection error
    Parameters:
    • Object error data
  • disconnect. Fired upon a disconnection.
  • reconnect. Fired upon a successful reconnection.
    Parameters:
    • Number reconnection attempt number
  • reconnect_attempt. Fired upon an attempt to reconnect.
  • reconnecting. Fired upon an attempt to reconnect.
    Parameters:
    • Number reconnection attempt number
  • reconnect_error. Fired upon a reconnection attempt error.
    Parameters:
    • Object error object
  • reconnect_failed. Fired when couldn’t reconnect within reconnectionAttempts

Server-side events:

  • connection / connect. Fired upon a connection.
    Parameters:
    • Socket the incoming socket.

Edit:

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...