send method
Sends data to the client via the WebSocket connection.
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 send(dynamic data, {int status = 200, String? path}) async {
var res = <String, dynamic>{};
res['path'] = path ?? '';
res['status'] = status;
res['timestamp'] = DateTime.now().millisecondsSinceEpoch;
res['language'] = rq.getLanguage();
res['client'] = id;
res['data'] = data;
socket.add(WaJson.jsonEncoder(res));
}