smartuniverse/ts/smartuniverse.classes.clientuniversechannel.ts
2019-04-22 13:06:01 +02:00

40 lines
1.0 KiB
TypeScript

import * as plugins from './smartuniverse.plugins';
import * as interfaces from './interfaces';
import { ClientUniverse } from './';
export class ClientUniverseChannel implements interfaces.IUniverseChannel {
// ======
// STATIC
// ======
public static async createClientUniverseChannel(
clientUniverseArg: ClientUniverse,
channelName: string,
passphraseArg: string
): Promise<ClientUniverseChannel> {
const clientChannel = new ClientUniverseChannel(clientUniverseArg, passphraseArg);
await clientChannel.subscribe();
return clientChannel;
}
// ========
// INSTANCE
// ========
public clientUniverse: ClientUniverse;
public passphrase: string;
constructor(clientUniverseArg: ClientUniverse, passphraseArg: string) {
this.clientUniverse = clientUniverseArg;
this.passphrase = passphraseArg;
}
/**
* subscribes to a channel
* tells the universe about this instances interest into a channel
*/
public async subscribe() {
this.clientUniverse.socketClient;
}
}