implement chat message sending
This commit is contained in:
1 parent
cbd8452ee5
commit
e57e5ba16a
5 files changed
+199
-114
No files matched your search
+8
-4
@@ -5,6 +5,9 @@ const ws = new WebSocket('ws://localhost:5000/ws');
|
||||
var nonceCounter = 1;
|
||||
var nonceCallbacks = {};
|
||||
|
||||
var messageQueue = [];
|
||||
var messageResolverQueue = [];
|
||||
|
||||
// Setup
|
||||
|
||||
ws.on('open', function open() {
|
||||
@@ -26,7 +29,6 @@ ws.on('message', function incoming(rawMessage) {
|
||||
} else {
|
||||
messageQueue.push(parsed);
|
||||
}
|
||||
console.log(parsed);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -84,9 +86,11 @@ async function testChats () {
|
||||
let response = await send('get-chats')
|
||||
let chat = response.chats[0];
|
||||
|
||||
let msgRes = await send('chat-send-message', {
|
||||
chatId: chat.id,
|
||||
content: "Hello World!",
|
||||
let msgRes = await send('send-chat-message', {
|
||||
body: {
|
||||
chatId: chat.id,
|
||||
content: "Hello World!",
|
||||
}
|
||||
});
|
||||
console.log('message sent', msgRes);
|
||||
|
||||
|
||||
Reference in new issue
Block a user