channel method

  1. @override
SocketIoChannel channel(
  1. String name
)
override

Get a channel instance by name.

Implementation

@override
SocketIoChannel channel(String name) {
  if (channels[name] == null) {
    if (name.startsWith('private-encrypted-')) {
      channels[name] = SocketIoPrivateEncryptedChannel(
        socket,
        name,
        options as SocketIoConnectorOptions,
      );
    } else if (name.startsWith('private-')) {
      channels[name] = SocketIoPrivateChannel(
        socket,
        name,
        options as SocketIoConnectorOptions,
      );
    } else if (name.startsWith('presence-')) {
      channels[name] = SocketIoPresenceChannel(
        socket,
        name,
        options as SocketIoConnectorOptions,
      );
    } else {
      channels[name] = SocketIoChannel(
        socket,
        name,
        options as SocketIoConnectorOptions,
      );
    }
  }

  return channels[name] as SocketIoChannel;
}