sendAction method

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

Implementation

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