Client: get chatID and nickname via parameters
This commit is contained in:
parent
3c9492d4b6
commit
23339dedce
2 changed files with 20 additions and 8 deletions
|
|
@ -15,7 +15,9 @@ class UI {
|
|||
this.initUI();
|
||||
|
||||
// TODO start client only after the user entered their nickname
|
||||
this.initClient();
|
||||
let chatID = "42";
|
||||
let nickname = "binaryDiv";
|
||||
this.initClient(chatID, nickname);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -27,10 +29,13 @@ class UI {
|
|||
|
||||
/**
|
||||
* Create instance of Client and initialize connection.
|
||||
*
|
||||
* chatID: The ID of the chat instance.
|
||||
* nickname: The user's nickname.
|
||||
*/
|
||||
initClient() {
|
||||
initClient(chatID, nickname) {
|
||||
const wsUri = AppSettings.serverWsUri;
|
||||
this.client = new Client(wsUri);
|
||||
this.client = new Client(wsUri, chatID, nickname);
|
||||
|
||||
// Subscribe to Client events
|
||||
this.client.on("initialized", this._onClientInit.bind(this));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue