ChannelMessage.inbound constructor

ChannelMessage.inbound(
  1. String channel,
  2. dynamic payload, {
  3. int? sequence,
  4. ChannelMessageType type = ChannelMessageType.message,
})

Create an inbound (server-to-client) message

Implementation

factory ChannelMessage.inbound(
  String channel,
  dynamic payload, {
  int? sequence,
  ChannelMessageType type = ChannelMessageType.message,
}) {
  return ChannelMessage(
    id: _generateId(),
    channel: channel,
    direction: ChannelMessageDirection.serverToClient,
    type: type,
    payload: payload,
    timestamp: DateTime.now(),
    sequence: sequence,
  );
}