hackchat-engine 1.1.13 → 1.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Client.js +11 -0
- package/package.json +1 -1
- package/structures/SessionStruct.js +7 -27
- package/util/Constants.js +1 -0
- package/websocket/SocketHandler.js +1 -1
package/Client.js
CHANGED
|
@@ -442,6 +442,17 @@ class Client extends EventEmitter {
|
|
|
442
442
|
|
|
443
443
|
this.ws.send(payload);
|
|
444
444
|
}
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* Unsubscribe from a channel
|
|
448
|
+
* @param {string} channel The channel to leave
|
|
449
|
+
*/
|
|
450
|
+
leave(channel) {
|
|
451
|
+
this.ws.send({
|
|
452
|
+
cmd: OPCodes.LEAVE,
|
|
453
|
+
channel: channel || this.channel, // @todo Multichannel
|
|
454
|
+
});
|
|
455
|
+
}
|
|
445
456
|
}
|
|
446
457
|
|
|
447
458
|
export default Client;
|
package/package.json
CHANGED
|
@@ -21,28 +21,10 @@ class SessionStruct {
|
|
|
21
21
|
*/
|
|
22
22
|
setup(data) {
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
25
|
-
* @type {number}
|
|
26
|
-
*/
|
|
27
|
-
this.channelCount = data.chans;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Available public channels and their user count
|
|
24
|
+
* Currently connected channels
|
|
31
25
|
* @type {object}
|
|
32
26
|
*/
|
|
33
|
-
this.
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Current session id
|
|
37
|
-
* @type {string}
|
|
38
|
-
*/
|
|
39
|
-
this.sessionID = data.sessionID;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Current channel count
|
|
43
|
-
* @type {number}
|
|
44
|
-
*/
|
|
45
|
-
this.userCount = data.users;
|
|
27
|
+
this.channels = data.channels;
|
|
46
28
|
|
|
47
29
|
/**
|
|
48
30
|
* Was this a new or renewed session
|
|
@@ -50,13 +32,11 @@ class SessionStruct {
|
|
|
50
32
|
*/
|
|
51
33
|
this.restored = data.restored;
|
|
52
34
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
}
|
|
35
|
+
/**
|
|
36
|
+
* The new token
|
|
37
|
+
* @type {string}
|
|
38
|
+
*/
|
|
39
|
+
this.token = data.token;
|
|
60
40
|
}
|
|
61
41
|
}
|
|
62
42
|
|
package/util/Constants.js
CHANGED