Categories
JavaScript Answers

What is the list of Socket.io events?

Spread the love

In this article, we’ll look at the list of Socket.io events.

The list of client side events for socket.io object includes:

  • 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

The list of client-side events for socket object includes:

  • 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

The list of server-side events includes:

connection / connect – Fired upon a connection. Parameters: Socket

  • the incoming socket.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *