Debugging your websocket connections with curl

I recently needed a quick way to debug my socket connections. Of course, curl seems like the right tool for the job here so:

$ curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host:" -H "Origin:"

Change the urls to your server and you should see some upgrade information as your connection upgrades from http to ws.

Found this nifty little job here:

Have fun!

2 thoughts on “Debugging your websocket connections with curl

  1. does not work to me. This produces the following response:

    $ curl -i -N -H “Connection: Upgrade” -H “Upgrade: websocket” -H “Host: echo.we” -H “Origin: http://www.websocket.org
    HTTP/1.1 404 Not Found
    X-Bst-Request-Id: tgcmWh:dtp:28956
    X-Bst-Info: t=1471431434,h=11x,p=36899_3300:2_9722,u=53094536,c=2339,v=7.9.54275
    Content-Type: text/html
    Content-Length: 61
    Connection: keep-alive
    Via: 1.1 hosted.websense 11x

    404 Not Found

Leave a Reply

Your email address will not be published. Required fields are marked *