Add ability to set initial user status.
Setting the status after joining (using the "setstatus" action) may cause multiple "user" messages to be sent to clients. Add the ability to set the initial status at join time.
This commit is contained in:
+7
-3
@@ -416,15 +416,19 @@ ServerConnection.prototype.connect = async function(url) {
|
||||
* @param {string} group - The name of the group to join.
|
||||
* @param {string} username - the username to join as.
|
||||
* @param {string} password - the password.
|
||||
* @param {Object<string,any>} [status] - the initial status of the user.
|
||||
*/
|
||||
ServerConnection.prototype.join = function(group, username, password) {
|
||||
this.send({
|
||||
ServerConnection.prototype.join = function(group, username, password, status) {
|
||||
let m = {
|
||||
type: 'join',
|
||||
kind: 'join',
|
||||
group: group,
|
||||
username: username,
|
||||
password: password,
|
||||
});
|
||||
};
|
||||
if(status)
|
||||
m.status = status;
|
||||
this.send(m);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user