mirror of
https://github.com/torappinfo/uweb.git
synced 2025-01-15 16:40:57 +01:00
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
|