sendAction method

  1. @override
void sendAction(
  1. String contactPubsubToken,
  2. DOOActionType actionType
)
override

Implementation

@override
void sendAction(String contactPubsubToken, DOOActionType actionType) {
  final DOOAction action;
  final identifier = jsonEncode(
      {"channel": "RoomChannel", "pubsub_token": contactPubsubToken});
  switch (actionType) {
    case DOOActionType.subscribe:
      action = DOOAction(identifier: identifier, command: "subscribe");
      break;
    default:
      action = DOOAction(
          identifier: identifier,
          data: DOOActionData(action: actionType),
          command: "message");
      break;
  }
  connection?.sink.add(jsonEncode(action.toJson()));
}