send method
Publish a Resgate message on the websocket channel.
Implementation
Future<int> send(
String type,
String? rid,
Map<String, dynamic>? params,
) async {
var id = currentId++;
Map<String, dynamic> msg = {
"id": id,
};
if (rid != null) {
msg["method"] = "$type.$rid";
} else {
msg["method"] = type;
}
if (params != null) {
msg["params"] = params;
}
await channel.ready;
channel.sink.add(jsonEncode(msg));
return id;
}