Skip to content

Instantly share code, notes, and snippets.

View nipund's full-sized avatar

Nipun Dayanath nipund

  • Davenport, IA
View GitHub Profile
@Checksum
Checksum / websocket_proxy.js
Last active June 22, 2025 02:35
Intercepting WebSockets in the browser using JavaScript
const WebSocketProxy = new Proxy(window.WebSocket, {
construct(target, args) {
console.log("Proxying WebSocket connection", ...args);
const ws = new target(...args);
// Configurable hooks
ws.hooks = {
beforeSend: () => null,
beforeReceive: () => null
};