Intro

Party Social utilities WebSockets via Socket.io for real-time communication during games. Through WebSockets, players can send and receive messages instantly, creating a dynamic and engaging game environment. This technology ensures that actions taken by players are reflected immediately without the need for manual refreshes, contributing to an immersive user experience.

How Events Work in Socket.io

Socket.io uses event-driven communication to manage interactions between clients and the server. Each event has a unique name and can carry data. Below is a basic example:

  1. Emitting Events: The client or server can emit events using the emit function.

    socket.emit('eventName', data);
  2. Listening for Events: To listen for events, the client or server can use the on function.

    socket.on('eventName', data => {
    // Handle event here
    });

Last updated