joinChannel method

  1. @override
Future<Map<String, dynamic>> joinChannel(
  1. String topic,
  2. Map<String, dynamic> params
)
override

Joins (or re-joins) a Phoenix channel with the given params. The transport routes subsequent pushes on topic via push and emits incoming events through events.

Returns the server's join reply payload (e.g. {messages: [...]} for the conversation channel). Callers may ignore it when not needed.

Implementations MUST:

  • Complete successfully only after the channel has been joined (reply received).
  • Throw a plain Exception if the server rejects the join.

Implementation

@override
Future<Map<String, dynamic>> joinChannel(
  String topic,
  Map<String, dynamic> params,
) async {
  recorded.joinedChannels.add(topic);
  recorded.joinedChannelParams.add(Map.of(params));
  return _joinPayloads[topic] ?? {};
}