mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 02:48:26 +00:00
Encode ws messages as JSON
This commit is contained in:
@ -157,8 +157,12 @@ function initWS() {
|
||||
console.log("Initialize websocket at " + url);
|
||||
dsWebSocket = new WebSocket(url);
|
||||
dsWebSocket.addEventListener("message", function(event) {
|
||||
if (event.data != "keep-alive" && event.data) {
|
||||
elmApp.ports.receiveWsMessage.send(event.data);
|
||||
|
||||
if (event.data) {
|
||||
var dataJSON = JSON.parse(event.data);
|
||||
if (dataJSON.tag !== "keep-alive") {
|
||||
elmApp.ports.receiveWsMessage.send(dataJSON);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user