Methods
addRoom(roomName, stateopt, cbopt) → {Promise.<undefined>}
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
state.whitelist |
Array.<string> |
<optional> |
[]
|
Room whitelist. |
state.blacklist |
Array.<string> |
<optional> |
[]
|
Room blacklist |
state.adminlist |
Array.<string> |
<optional> |
[]
|
Room adminlist. |
state.whitelistOnly |
boolean |
<optional> |
false
|
Room whitelistOnly mode. |
state.owner |
string |
<optional> |
Room owner. |
|
state.historyMaxSize |
number |
<optional> |
Room history maximum
size. Defalut value is |
|
state.enableAccessListsUpdates |
boolean |
<optional> |
Room enable
access lists updates. Defalut value is |
|
state.enableUserlistUpdates |
boolean |
<optional> |
Room enable
userlist updates. Defalut value is |
Adds a room with a state.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
roomName |
string | Room name. |
|
state |
Object |
<optional> |
Room state. |
cb |
callback |
<optional> |
Optional callback. |
Returns:
Promise that resolves without any data.
- Type
- Promise.<undefined>
addUser(userName, stateopt, cbopt) → {Promise.<undefined>}
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
state.whitelist |
Array.<string> |
<optional> |
[]
|
User direct messages whitelist. |
state.blacklist |
Array.<string> |
<optional> |
[]
|
User direct messages blacklist. |
state.whitelistOnly |
boolean |
<optional> |
false
|
User direct messages whitelistOnly mode. |
Adds an user with a state.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
userName |
string | User name. |
|
state |
Object |
<optional> |
User state. |
cb |
callback |
<optional> |
Optional callback. |
Returns:
Promise that resolves without any data.
- Type
- Promise.<undefined>
changeAccessListsUpdates(roomName, mode, cbopt) → {Promise.<undefined>}
- See:
Enables or disables access lists updates for the room.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
roomName |
string | Room name. |
|
mode |
boolean | Enable or disable. |
|
cb |
callback |
<optional> |
Optional callback. |
Returns:
Promise that resolves without any data.
- Type
- Promise.<undefined>
changeRoomHistoryMaxSize(roomName, size, cbopt) → {Promise.<undefined>}
Changes the room history size.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
roomName |
string | Room name. |
|
size |
number | Room history size. |
|
cb |
callback |
<optional> |
Optional callback. |
Returns:
Promise that resolves without any data.
- Type
- Promise.<undefined>
changeRoomOwner(roomName, owner, cbopt) → {Promise.<undefined>}
Changes the room owner.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
roomName |
string | Room name. |
|
owner |
string | Owner user name. |
|
cb |
callback |
<optional> |
Optional callback. |
Returns:
Promise that resolves without any data.
- Type
- Promise.<undefined>
changeUserlistUpdates(roomName, mode, cbopt) → {Promise.<undefined>}
Enables or disables user list updates for the room.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
roomName |
string | Room name. |
|
mode |
boolean | Enable or disable. |
|
cb |
callback |
<optional> |
Optional callback. |
Returns:
Promise that resolves without any data.
- Type
- Promise.<undefined>
deleteRoom(roomName, cbopt) → {Promise.<undefined>}
Removes all joined users from the room and removes all room data.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
roomName |
string | Room name. |
|
cb |
callback |
<optional> |
Optional callback. |
Returns:
Promise that resolves without any data.
- Type
- Promise.<undefined>
deleteUser(userName, cbopt) → {Promise.<undefined>}
Deletes an offline user. Will raise an error if a user has online sockets.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
userName |
string | User name. |
|
cb |
callback |
<optional> |
Optional callback. |
Returns:
Promise that resolves without any data.
- Type
- Promise.<undefined>
disconnectUserSockets(userName) → {undefined}
Disconnects user's sockets for all service instances. Method is asynchronous, returns without waiting for the completion.
Parameters:
Name | Type | Description |
---|---|---|
userName |
string | User name. |
Returns:
Returns no data.
- Type
- undefined
execUserCommand(context, command, …args, cbopt) → {Promise.<Array>}
- See:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
context.userName |
string |
<optional> |
User name. |
|
context.id |
string |
<optional> |
Socket id, it is required for
|
|
context.bypassHooks |
boolean |
<optional> |
false
|
If |
context.bypassPermissions |
boolean |
<optional> |
false
|
If |
Executes rpc.clientRequests
handlers.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
context |
string | boolean | Object | Is a |
|
command |
string | Command name. |
|
args |
* |
<repeatable> |
Command arguments. |
cb |
callback |
<optional> |
Optional callback. |
Returns:
Array of command results.
- Type
- Promise.<Array>
hasDirectAccess(recipient, sender, cbopt) → {Promise.<boolean>}
Checks for a direct messaging permission.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
recipient |
string | Recipient name. |
|
sender |
string | Sender name. |
|
cb |
callback |
<optional> |
Optional callback. |
Returns:
Predicate result.
- Type
- Promise.<boolean>
hasRoom(roomName, cbopt) → {Promise.<boolean>}
Checks for a room existence.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
roomName |
string | Room name. |
|
cb |
callback |
<optional> |
Optional callback. |
Returns:
Predicate result.
- Type
- Promise.<boolean>
hasRoomAccess(roomName, userName, cbopt) → {Promise.<boolean>}
Checks for a room access permission.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
roomName |
string | Room name. |
|
userName |
string | User name. |
|
cb |
callback |
<optional> |
Optional callback. |
Returns:
Predicate result.
- Type
- Promise.<boolean>
hasUser(userName, cbopt) → {Promise.<boolean>}
Checks for an user existence.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
userName |
string | User name. |
|
cb |
callback |
<optional> |
Optional callback. |
Returns:
Predicate result.
- Type
- Promise.<boolean>
roomHasInList(roomName, listName, item, cbopt) → {Promise.<boolean>}
Checks for a name existence in a room list.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
roomName |
string | Room name. |
|
listName |
string | List name. |
|
item |
string | List element. |
|
cb |
callback |
<optional> |
Optional callback. |
Returns:
Predicate result.
- Type
- Promise.<boolean>
userHasInList(userName, listName, item, cbopt) → {Promise.<boolean>}
Checks for a name existence in a direct messaging list.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
userName |
string | User name. |
|
listName |
string | List name. |
|
item |
string | List element. |
|
cb |
callback |
<optional> |
Optional callback. |
Returns:
Predicate result.
- Type
- Promise.<boolean>