Skip to content

Instantly share code, notes, and snippets.

@apuravchauhan
Last active May 24, 2025 00:27
Show Gist options
  • Save apuravchauhan/c5c7637c40637e871c1d69985283248e to your computer and use it in GitHub Desktop.
Save apuravchauhan/c5c7637c40637e871c1d69985283248e to your computer and use it in GitHub Desktop.
const WebSocket = require('ws');
const port = 9001;
const ws = new WebSocket('ws://localhost:' + port);
ws.on('message', (data) => {
/**Uncomment below To slow the event loop to simulate a slow client */
/*
while (new Date().getTime() - start <= 500 ) {
// Do nothing - just block the thread
}
*/
console.log(data);
});
@apuravchauhan
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment