mirror of
https://github.com/go-gitea/gitea
synced 2025-02-05 20:07:00 +01:00
use custom create-websocket
This commit is contained in:
parent
b805631ea2
commit
7de741c838
@ -21,6 +21,13 @@ document.body.addEventListener('htmx:responseError', (event) => {
|
|||||||
showErrorToast(`Error ${event.detail.xhr.status} when calling ${event.detail.requestConfig.path}`);
|
showErrorToast(`Error ${event.detail.xhr.status} when calling ${event.detail.requestConfig.path}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-import-assign
|
||||||
|
htmx.createWebSocket = (url) => {
|
||||||
|
// TODO: reuse websocket from shared webworker
|
||||||
|
const sock = new WebSocket(url, []);
|
||||||
|
sock.binaryType = htmx.config.wsBinaryType;
|
||||||
|
return sock;
|
||||||
|
};
|
||||||
document.body.addEventListener('htmx:wsOpen', (evt) => {
|
document.body.addEventListener('htmx:wsOpen', (evt) => {
|
||||||
const socket = evt.detail.socketWrapper;
|
const socket = evt.detail.socketWrapper;
|
||||||
socket.send(JSON.stringify({action: 'subscribe', data: {url: window.location.href}}));
|
socket.send(JSON.stringify({action: 'subscribe', data: {url: window.location.href}}));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user