Skip to content

Commit

Permalink
ShimWebSocket: receive msg from main process on prefixed channels, fi…
Browse files Browse the repository at this point in the history
…x double echo issue
  • Loading branch information
layerssss committed Jun 19, 2019
1 parent cd2ad12 commit 45f9c69
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ class App {
if (!socketHandlers[evt]) return;
for (const handler of socketHandlers[evt]) handler(...data);
},
send: message => connectEvt.sender.send("main-message", message)
send: message =>
connectEvt.sender.send(`main-message-${socketId}`, message)
};

const socketOnMessage = (evt, message) => {
Expand Down
2 changes: 1 addition & 1 deletion src/shim_web_socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if (isElectorn()) {
constructor(url) {
this.id = `${Date.now()}${Math.floor(Math.random() * 1000)}`;

ipcRenderer.on("main-message", (evt, message) => {
ipcRenderer.on(`main-message-${this.id}`, (evt, message) => {
this.onmessage({
data: message
});
Expand Down

0 comments on commit 45f9c69

Please sign in to comment.