sendMessageOnChannel method

void sendMessageOnChannel(
  1. String message,
  2. WebSocketChannel webSocketChannel,
  3. Channel channel
)

Implementation

void sendMessageOnChannel(
    String message, WebSocketChannel webSocketChannel, Channel channel) {
  Map msg = {
    "msg": "method",
    "method": "sendMessage",
    "id": "42",
    "params": [
      {"rid": channel.id, "msg": message}
    ]
  };

  webSocketChannel.sink.add(jsonEncode(msg));
}