JSLib Reference Manual / Exports / Channel

Class: Channel#

Channel Class

Join a channel, returns channel object.

Currently, you must have an identity when connecting, because every single message is signed by sender. TODO is to look at how to provide a ‘listening’ mode on channels.

Most classes in SB follow the “ready” template: objects can be used right away, but they decide for themselves if they’re ready or not.

Hierarchy#

Table of contents#

Constructors#

Properties#

Accessors#

Methods#

Constructors#

constructor#

new Channel(sbServer, key?, channelId?)

Parameters#

Name

Type

sbServer

SBServer

key?

JsonWebKey

channelId?

string

Overrides#

SB384.constructor

Properties#

#ChannelReadyFlag#

Private #ChannelReadyFlag: boolean = false


#SB384ReadyFlag#

Private #SB384ReadyFlag: boolean = false

Inherited from#

SB384.#SB384ReadyFlag


#api#

Private #api: ChannelApi


#channelId#

Private Optional #channelId: string


#exportable_privateKey#

Private #exportable_privateKey: null | JsonWebKey = null

Inherited from#

SB384.#exportable_privateKey


#exportable_pubKey#

Private #exportable_pubKey: null | JsonWebKey = null

Inherited from#

SB384.#exportable_pubKey


#keyPair#

Private #keyPair: null | CryptoKeyPair = null

Inherited from#

SB384.#keyPair


#ownerChannelId#

Private #ownerChannelId: null | string = null

Inherited from#

SB384.#ownerChannelId


#privateKey#

Private #privateKey: null | CryptoKey = null

Inherited from#

SB384.#privateKey


#sbServer#

Private #sbServer: SBServer


admin#

admin: boolean = false


adminData#

Optional Abstract adminData: Dictionary<any>


channelReady#

channelReady: Promise<Channel>


locked#

Optional locked: boolean = false


motd#

Optional motd: string = ''


owner#

owner: boolean = false


ready#

ready: Promise<Channel>

Param

server to join

Param

key to use to join (optional)

Param

(the :term:Channel Name) to find on that server (optional)

Overrides#

SB384.ready


sb384Ready#

sb384Ready: Promise<SB384>

Inherited from#

SB384.sb384Ready


userName#

userName: string = ''


verifiedGuest#

verifiedGuest: boolean = false

Accessors#

_id#

get _id(): string

Returns#

string

Inherited from#

SB384._id


api#

get api(): ChannelApi

Returns#

ChannelApi


channelId#

get channelId(): undefined | string

Returns#

undefined | string


exportable_privateKey#

get exportable_privateKey(): null | JsonWebKey

Returns#

null | JsonWebKey

Inherited from#

SB384.exportable_privateKey


exportable_pubKey#

get exportable_pubKey(): null | JsonWebKey

Returns#

null | JsonWebKey

Inherited from#

SB384.exportable_pubKey


keyPair#

get keyPair(): null | CryptoKeyPair

Returns#

null | CryptoKeyPair

Inherited from#

SB384.keyPair


keys#

Abstract get keys(): ChannelKeys

Returns#

ChannelKeys


onMessage#

Abstract set onMessage(f): void

Parameters#

Name

Type

f

CallableFunction

Returns#

void


ownerChannelId#

get ownerChannelId(): null | string

Returns#

null | string

Inherited from#

SB384.ownerChannelId


privateKey#

get privateKey(): null | CryptoKey

Returns#

null | CryptoKey

Inherited from#

SB384.privateKey


readyFlag#

get readyFlag(): boolean

Returns#

boolean

Overrides#

SB384.readyFlag


sbServer#

get sbServer(): SBServer

Returns#

SBServer

Methods#

#generateRoomHash#

Private #generateRoomHash(channelBytes): Promise<string>

Parameters#

Name

Type

channelBytes

ArrayBuffer

Returns#

Promise<string>

Inherited from#

SB384.#generateRoomHash


#generateRoomId#

Private #generateRoomId(x, y): Promise<string>

Parameters#

Name

Type

x

string

y

string

Returns#

Promise<string>

Inherited from#

SB384.#generateRoomId


send#

Abstract send(m, messageType?): Promise<string>

Parameters#

Name

Type

m

string | SBMessage

messageType?

"string" | "SBMessage"

Returns#

Promise<string>