Client: get chatID and nickname via parameters

This commit is contained in:
Lexi / Zoe 2019-02-24 16:53:25 +01:00
parent 3c9492d4b6
commit 23339dedce
Signed by: binaryDiv
GPG key ID: F8D4956E224DA232
2 changed files with 20 additions and 8 deletions

View file

@ -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));