JSLib Reference Manual / Exports / ChannelSocket

Class: ChannelSocket#

ChannelSocket

Class managing connections

Hierarchy#

Table of contents#

Constructors#

Properties#

Accessors#

Methods#

Constructors#

constructor#

new ChannelSocket(sbServer, onMessage, key?, channelId?)

ChannelSocket

Parameters#

Name

Type

sbServer

SBServer

onMessage

(m: ChannelMessage) => void

key?

JsonWebKey

channelId?

string

Overrides#

Channel.constructor

Properties#

#ChannelReadyFlag#

Private #ChannelReadyFlag: boolean = false

Inherited from#

Channel.#ChannelReadyFlag


#ChannelSocketReadyFlag#

Private #ChannelSocketReadyFlag: boolean = false


#SB384ReadyFlag#

Private #SB384ReadyFlag: boolean = false

Inherited from#

Channel.#SB384ReadyFlag


#ack#

Private #ack: Dictionary<any> = []


#api#

Private #api: ChannelApi

Inherited from#

Channel.#api


#channelId#

Private Optional #channelId: string

Inherited from#

Channel.#channelId


#exportable_owner_pubKey#

Private #exportable_owner_pubKey: null | JsonWebKey = null


#exportable_privateKey#

Private #exportable_privateKey: null | JsonWebKey = null

Inherited from#

Channel.#exportable_privateKey


#exportable_pubKey#

Private #exportable_pubKey: null | JsonWebKey = null

Inherited from#

Channel.#exportable_pubKey


#keyPair#

Private #keyPair: null | CryptoKeyPair = null

Inherited from#

Channel.#keyPair


#keys#

Private Optional #keys: ChannelKeys


#onMessage#

Private #onMessage: (m: ChannelMessage) => void

Type declaration#

▸ (m): void

Parameters#

Name

Type

m

ChannelMessage

Returns#

void


#ownerChannelId#

Private #ownerChannelId: null | string = null

Inherited from#

Channel.#ownerChannelId


#privateKey#

Private #privateKey: null | CryptoKey = null

Inherited from#

Channel.#privateKey


#sbServer#

Private #sbServer: SBServer

Inherited from#

Channel.#sbServer


#sbServer#

Private #sbServer: SBServer

Inherited from#

Channel.#sbServer


#traceSocket#

Private #traceSocket: boolean = false


#ws#

Private #ws: WSProtocolOptions


admin#

admin: boolean = false

Inherited from#

Channel.admin


adminData#

Optional adminData: Dictionary<any>

Overrides#

Channel.adminData


channelReady#

channelReady: Promise<Channel>

Inherited from#

Channel.channelReady


locked#

Optional locked: boolean = false

Inherited from#

Channel.locked


motd#

Optional motd: string = ''

Inherited from#

Channel.motd


owner#

owner: boolean = false

Inherited from#

Channel.owner


ready#

ready: Promise<ChannelSocket>

Param

server to join

Param

key to use to join (optional)

Param

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

Overrides#

Channel.ready


sb384Ready#

sb384Ready: Promise<SB384>

Inherited from#

Channel.sb384Ready


userName#

userName: string = ''

Inherited from#

Channel.userName


verifiedGuest#

verifiedGuest: boolean = false

Inherited from#

Channel.verifiedGuest

Accessors#

_id#

get _id(): string

Returns#

string

Inherited from#

Channel._id


api#

get api(): ChannelApi

Returns#

ChannelApi

Inherited from#

Channel.api


channelId#

get channelId(): undefined | string

Returns#

undefined | string

Inherited from#

Channel.channelId


enableTrace#

set enableTrace(b): void

Parameters#

Name

Type

b

boolean

Returns#

void


exportable_owner_pubKey#

get exportable_owner_pubKey(): null | JsonWebKey

Returns#

null | JsonWebKey


exportable_privateKey#

get exportable_privateKey(): null | JsonWebKey

Returns#

null | JsonWebKey

Inherited from#

Channel.exportable_privateKey


exportable_pubKey#

get exportable_pubKey(): null | JsonWebKey

Returns#

null | JsonWebKey

Inherited from#

Channel.exportable_pubKey


keyPair#

get keyPair(): null | CryptoKeyPair

Returns#

null | CryptoKeyPair

Inherited from#

Channel.keyPair


keys#

get keys(): ChannelKeys

ChannelSocket.keys

Will throw an exception if keys are unknown or not yet loaded

Returns#

ChannelKeys

Overrides#

Channel.keys


onMessage#

get onMessage(): (m: ChannelMessage) => void

Returns#

fn

▸ (m): void

Parameters#

Name

Type

m

ChannelMessage

Returns#

void

Overrides#

Channel.onMessage

set onMessage(f): void

Parameters#

Name

Type

f

(m: ChannelMessage) => void

Returns#

void

Overrides#

Channel.onMessage


ownerChannelId#

get ownerChannelId(): null | string

Returns#

null | string

Inherited from#

Channel.ownerChannelId


privateKey#

get privateKey(): null | CryptoKey

Returns#

null | CryptoKey

Inherited from#

Channel.privateKey


readyFlag#

get readyFlag(): boolean

Returns#

boolean

Inherited from#

Channel.readyFlag


sbServer#

get sbServer(): SBServer

Returns#

SBServer

Inherited from#

Channel.sbServer


status#

get status(): "CLOSED" | "CONNECTING" | "OPEN" | "CLOSING"

Returns#

"CLOSED" | "CONNECTING" | "OPEN" | "CLOSING"

Methods#

#generateRoomHash#

Private #generateRoomHash(channelBytes): Promise<string>

Parameters#

Name

Type

channelBytes

ArrayBuffer

Returns#

Promise<string>

Inherited from#

Channel.#generateRoomHash


#generateRoomId#

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

Parameters#

Name

Type

x

string

y

string

Returns#

Promise<string>

Inherited from#

Channel.#generateRoomId


#processMessage#

Private #processMessage(m): void

Parameters#

Name

Type

m

any

Returns#

void


#readyPromise#

Private #readyPromise(): Promise<ChannelSocket>

Returns#

Promise<ChannelSocket>


checkServerStatus#

checkServerStatus(url, timeout, callback): void

Parameters#

Name

Type

url

string

timeout

number

callback

(online: boolean) => void

Returns#

void


close#

close(): void

Returns#

void


send#

send(msg): Promise<string>

ChannelSocket.send()

Returns a promise that resolves to “success” when sent, or an error message if it fails.

Parameters#

Name

Type

msg

string | SBMessage

Returns#

Promise<string>

Overrides#

Channel.send


sendSbObject#

sendSbObject(file): Promise<string>

ChannelSocket.sendSbObject()

Send SB object (file) on channel socket

Parameters#

Name

Type

file

SBFile

Returns#

Promise<string>