sendToUser method

Future sendToUser(
  1. String id,
  2. dynamic data, {
  3. int status = 200,
  4. String? path,
})

Sends data to all clients associated with a specific user.

The id parameter is the user ID. The data parameter is the message to be sent. The optional status parameter represents the HTTP status code. The optional path parameter represents the message path or route.

Implementation

Future sendToUser(
  String id,
  dynamic data, {
  int status = 200,
  String? path,
}) async {
  session.getUserClientsSocket(id).forEach((clientSocket) {
    clientSocket.send(data, status: status, path: path);
  });
}