html bubbles, more simplifications, new session protocol

This commit is contained in:
Andrew Gundersen 2022-01-08 16:53:45 -06:00
commit d3f99d6133
21 changed files with 340 additions and 169 deletions

View file

@ -1,7 +1,7 @@
const WebSocket = require("ws");
const { ipcMain } = require("electron");
const config = require("./config");
const { ipcMain } = require("electron");
const { updateTray } = require("./tray");
const { backgroundMitt, ipcEmit } = require("./utils/emitter");
@ -22,7 +22,7 @@ function connectToPlatform(account)
.on("error", () => {}) /** keep silent on error */
.on("message", (payload) => backgroundMitt.emit("ws-message", JSON.parse(payload)))
.on("message", (payload) => backgroundMitt.emit("message", JSON.parse(payload)))
.on("close", (code, reason) => {
setConnectionStatus(1);
@ -55,4 +55,26 @@ ipcMain.on("message", (_e, message) => sendMessage(message));
exports.connectToPlatform = connectToPlatform;
exports.sendMessage = sendMessage;
exports.disconnectFromPlatform = disconnectFromPlatform;
exports.disconnectFromPlatform = disconnectFromPlatform;
/* ------------- Test Messages------------- */
setTimeout(() => {
// sendMessage({
// category: "text/plain",
// text: "show contacts",
// blob: null
// })
sendMessage({
category: "text/plain",
text: "add contact John Smith, [email protected]",
blob: null
})
}, 2000);