We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b805631 commit 7de741cCopy full SHA for 7de741c
web_src/js/htmx.js
@@ -21,6 +21,13 @@ document.body.addEventListener('htmx:responseError', (event) => {
21
showErrorToast(`Error ${event.detail.xhr.status} when calling ${event.detail.requestConfig.path}`);
22
});
23
24
+// eslint-disable-next-line no-import-assign
25
+htmx.createWebSocket = (url) => {
26
+ // TODO: reuse websocket from shared webworker
27
+ const sock = new WebSocket(url, []);
28
+ sock.binaryType = htmx.config.wsBinaryType;
29
+ return sock;
30
+};
31
document.body.addEventListener('htmx:wsOpen', (evt) => {
32
const socket = evt.detail.socketWrapper;
33
socket.send(JSON.stringify({action: 'subscribe', data: {url: window.location.href}}));
0 commit comments