LaravelEcho<ClientType, ChannelType> constructor

LaravelEcho<ClientType, ChannelType>(
  1. StorageDatabase storageDatabase,
  2. Connector<ClientType, ChannelType> connector, {
  3. List<LaravelEchoMigration> migrations = const [],
})

Implementation

LaravelEcho(
  this.storageDatabase,
  super.connector, {
  this.migrations = const [],
}) : assert(
       ClientType == Socket || ClientType == PusherClient,
       'ClientType must be either Socket or PusherClient',
     ),
     assert(
       ChannelType == SocketIoChannel || ChannelType == PusherChannel,
       'ChannelType must be either SocketIoChannel or PusherChannel',
     ),
     assert(
       ClientType == Socket && ChannelType == SocketIoChannel ||
           ClientType == PusherClient && ChannelType == PusherChannel,
       'ClientType and ChannelType must be either Socket and SocketIoChannel or PusherClient and PusherChannel',
     ) {
  connector.onConnect((data) => _setupMigrations());

  if (ClientType == Socket) {
    _socketInstance = this as LaravelEcho<Socket, SocketIoChannel>;
  } else if (ClientType == PusherClient) {
    _pusherInstance = this as LaravelEcho<PusherClient, PusherChannel>;
  }
}