streamRoomMessagesSubscribe method

void streamRoomMessagesSubscribe(
  1. WebSocketChannel webSocketChannel,
  2. Room room, {
  3. required String token,
})

Implementation

void streamRoomMessagesSubscribe(WebSocketChannel webSocketChannel, Room room,
    {required String token}) {
  Map msg = {
    "msg": "sub",
    "id": room.id! + DateTime.now().millisecond.toString(),
    "name": "stream-room-messages",
    "params": [
      room.id,
      {"useCollection": false, "args": []}
    ]
  };
  logInfo('🚀🚀  streamRoomMessagesSubscribe $msg');
  webSocketChannel.sink.add(jsonEncode(msg));
}