Constructor
new Client(accessManager, options)
Parameters:
Name | Type | Description |
---|---|---|
accessManager |
AccessManager | String | The Client's AccessManager, or a Capability token JWT string. |
options |
Client#ClientOptions | Options to customize the Client |
Properties:
Name | Type | Description |
---|---|---|
accessManager |
AccessManager | The Client's AccessManager |
channels |
Map.<sid, Channel> | A Map containing all Channels known locally on the Client. To ensure the Channels have loaded before getting a response, use Client#getChannels. |
identity |
String | The unique identifier for the User of this Client. |
Fires:
Members
(readonly) version :String
Current version of this IP Messaging Client.
Type:
- String
Methods
createChannel(optionsopt) → {Promise.<Channel>}
Create a channel on the server.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
Client#CreateChannelOptions |
<optional> |
Options for the Channel |
Returns:
- Type
- Promise.<Channel>
getChannelBySid(channelSid) → {Promise.<Channel>}
Get a Channel by its SID.
Parameters:
Name | Type | Description |
---|---|---|
channelSid |
String | The sid of the Channel to get. |
Returns:
- Type
- Promise.<Channel>
getChannelByUniqueName(uniqueName) → {Promise.<Channel>}
Get a Channel by its unique identifier name.
Parameters:
Name | Type | Description |
---|---|---|
uniqueName |
String | The unique identifier name of the Channel to get. |
Returns:
- Type
- Promise.<Channel>
getChannels() → {Promise.<Array.<Channel>>}
Get the current list of all Channels the Client knows about.
Returns:
- Type
- Promise.<Array.<Channel>>
Type Definitions
ClientOptions
These options can be passed to Client constructor
Type:
- Object
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
logLevel |
String |
<optional> |
'error' | The level of logging to enable. Valid options (from strictest to broadest): ['silent', 'error', 'warn', 'info', 'debug', 'trace'] |
wsServer |
String |
<optional> |
A custom websocket server to connect to. |
CreateChannelOptions
These options can be passed to Client.createChannel
Type:
- Object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
attributes |
Object |
<optional> |
Any custom attributes to attach to the Channel. |
isPrivate |
Boolean |
<optional> |
Whether or not this Channel should be visible to uninvited Clients. |
friendlyName |
String |
<optional> |
The non-unique display name of the Channel. |
uniqueName |
String |
<optional> |
The unique identity name of the Channel. |
Events
channelAdded
Fired when a Channel becomes visible to the Client.
Parameters:
Name | Type | Description |
---|---|---|
channel |
Channel |
channelInvited
Fired when the Client is invited to a Channel.
Parameters:
Name | Type | Description |
---|---|---|
channel |
Channel |
channelJoined
Fired when the Client joins a Channel.
Parameters:
Name | Type | Description |
---|---|---|
channel |
Channel |
channelLeft
Fired when the Client leaves a Channel.
Parameters:
Name | Type | Description |
---|---|---|
channel |
Channel |
channelRemoved
Fired when a Channel is no longer visible to the Client.
Parameters:
Name | Type | Description |
---|---|---|
channel |
Channel |
channelUpdated
Fired when a Channel's attributes or metadata have been updated.
Parameters:
Name | Type | Description |
---|---|---|
channel |
Channel |
tokenExpired
Fired when the supplied token expires.