sendJson method
Sends a JSON message to the WebSocket server
Implementation
int sendJson(String method, [Map<String, dynamic>? params]) {
final id = rpcId;
rpcId++;
final jsonObject = <String, dynamic>{
'jsonrpc': JsonConstants.jsonRpcVersion,
'method': method,
'id': id,
'params': params ?? {},
};
final jsonString = jsonEncode(jsonObject);
webSocket?.add(jsonString);
return id;
}