Skip to content

Commit

Permalink
support multiple models of the same type
Browse files Browse the repository at this point in the history
  • Loading branch information
hhaensel committed Nov 10, 2024
1 parent 6e0792e commit 1aceee0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions assets/js/channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Genie.initWebChannel = function(channel = Genie.Settings.webchannels_default_rou
} else if (Object.keys(payload).length > 0) {
try {
await waitForOpenConnection(WebChannel)
WebChannel.send(msg);
WebChannel.socket.send(msg);
} catch (err) {
console.error(err);
console.warn('Could not send message: ' + msg);
Expand Down Expand Up @@ -60,7 +60,7 @@ Genie.initWebChannel = function(channel = Genie.Settings.webchannels_default_rou
WebChannel.socket = newSocketConnection(WebChannel);

WebChannel.processingHandlers.push(event => {
window.parse_payload(event.data);
window.parse_payload(WebChannel, event.data);
});

WebChannel.messageHandlers.push(event => {
Expand All @@ -73,7 +73,7 @@ Genie.initWebChannel = function(channel = Genie.Settings.webchannels_default_rou
}

if (ed.startsWith('{') && ed.endsWith('}')) {
window.parse_payload(JSON.parse(ed, Genie.Revivers.reviver));
window.parse_payload(WebChannel, JSON.parse(ed, Genie.Revivers.reviver));
} else if (ed.startsWith(Genie.Settings.webchannels_eval_command)) {
return Function('"use strict";return (' + ed.substring(Genie.Settings.webchannels_eval_command.length).trim() + ')')();
} else if (ed == 'Subscription: OK') {
Expand Down Expand Up @@ -230,7 +230,7 @@ Genie.Revivers.revive_undefined = function(key, value) {
Genie.Revivers.revivers = [Genie.Revivers.revive_undefined]
Genie.Revivers.rebuildReviver()

function parse_payload(json_data) {
function parse_payload(WebChannel, json_data) {
if (isDev()) {
console.info('Overwrite window.parse_payload to handle messages from the server');
console.info(json_data);
Expand Down

0 comments on commit 1aceee0

Please sign in to comment.