try to implement shoutbox composing idk if it works
Signed-off-by: Nicole Mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@@ -2775,6 +2775,7 @@ class PlApiClient {
|
||||
onMessages: (messages: Array<ShoutMessage>) => void;
|
||||
onMessage: (message: ShoutMessage) => void;
|
||||
}) => {
|
||||
let counter = 0;
|
||||
if (this.#shoutSocket) return this.#shoutSocket;
|
||||
|
||||
const path = buildFullPath('/socket/websocket', this.baseURL, { token, vsn: '2.0.0' });
|
||||
@@ -2798,7 +2799,8 @@ class PlApiClient {
|
||||
|
||||
this.#shoutSocket = {
|
||||
message: (text: string) => {
|
||||
ws.send(JSON.stringify({ type: 'message', text }));
|
||||
// guess this is meant to be incremented on each call but idk
|
||||
ws.send(JSON.stringify(['3', `${++counter}`, 'chat:public', 'new_msg', { 'text': text }]));
|
||||
},
|
||||
close: () => {
|
||||
ws.close();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pl-api",
|
||||
"version": "1.0.0-rc.35",
|
||||
"version": "1.0.0-rc.36",
|
||||
"type": "module",
|
||||
"homepage": "https://github.com/mkljczk/pl-fe/tree/develop/packages/pl-api",
|
||||
"repository": {
|
||||
|
||||
Reference in New Issue
Block a user