Skip to content

Instantly share code, notes, and snippets.

@markandrus
Created April 16, 2015 23:43
Show Gist options
  • Save markandrus/f85070652ec0804e5441 to your computer and use it in GitHub Desktop.
Save markandrus/f85070652ec0804e5441 to your computer and use it in GitHub Desktop.
Test HTTP 302 response to WebSocket upgrade request
#!/bin/sh
HTTP_PORT=9090
WS_PORT=9091
echo "HTTP/1.1 302 Found\r\nLocation: http://localhost:${WS_PORT}\r\nContent-Length: 0\r\n" | nc -l ${HTTP_PORT} &
wscat -l ${WS_PORT} &
wscat -c ws://localhost:${HTTP_PORT}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment