perform method

void perform(
  1. String action, [
  2. Map<String, dynamic>? params
])

send a message to a WebSocket channel on the server to its corresponding channel action

Implementation

void perform(String action, [Map<String, dynamic>? params]) {
  if (state == HotlineSubscriptionRequestState.suspended) return;

  final actionParams = {'action': action, 'id': 1};

  subscriptionManager.connection.socketChannel.sink.add(jsonEncode({
    'identifier': identifier,
    'command': 'message',
    'data': jsonEncode(actionParams),
  }));
}