send method
Implementation
@VoltronMethod(funcSend)
void send(VoltronMap params, final Promise promise) {
var socketId = params.get<int>('id');
if (socketId == null) {
LogUtils.d(kWebSocketModuleName, "close: ERROR: no socket id specified");
return;
}
var socketClient = mWebSocketConnections[socketId];
if (socketClient == null || !socketClient.isConnected) {
LogUtils.d(
kWebSocketModuleName, "send: ERROR: specified socket not found, or not connected yet");
return;
}
var textData = params.get<String>('data');
if (textData == null) {
LogUtils.d(kWebSocketModuleName, "send: ERROR: no data specified to be sent");
return;
}
socketClient.send(textData);
}