We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9156465 commit 9e2fd4fCopy full SHA for 9e2fd4f
src/modules/chat.ts
@@ -13,6 +13,22 @@ class CustomEventEmitter extends EventEmitter {}
13
const cbchat = {
14
eventEmitter: new CustomEventEmitter(),
15
16
+ getChatHistory() {
17
+ return new Promise((resolve, reject) => {
18
+ cbws.getWebsocket.send(JSON.stringify({
19
+ "type": "getChatHistory"
20
+ }));
21
+ cbws.getWebsocket.on('message', (data: string) => {
22
+ const response = JSON.parse(data);
23
+ if (response.type === "getChatHistoryResponse") {
24
+ resolve(response); // Resolve the Promise with the response data
25
+ }
26
+ })
27
28
+
29
30
31
32
/**
33
* Sends a message through the WebSocket connection.
34
* @param {string} message - The message to be sent.
0 commit comments