mirror of https://github.com/torappinfo/uweb
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
408 B
JavaScript
14 lines
408 B
JavaScript
window.WebSocketOriginal = window.WebSocket;
|
|
(function () {
|
|
function CustomWebSocket(url) {
|
|
const ws = new window.WebSocketOriginal(url);
|
|
Object.getOwnPropertyNames(window.WebSocket.prototype).forEach(methodName => {
|
|
if (methodName !== 'constructor') {
|
|
CustomWebSocket.prototype[methodName] = ws[methodName].bind(ws);
|
|
}
|
|
});
|
|
}
|
|
window.WebSocket = CustomWebSocket;
|
|
})();
|
|
t
|