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: echo.websocket.org" -H "Origin: http://www.websocket.org" http://echo.websocket.org

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: http://www.thenerdary.net/post/24889968081/debugging-websockets-with-curl

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
    bsocket.org” -H “Origin: http://www.websocket.orghttp://echo.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
    .147
    X-WS-PAC: http://pac.webdefence.global.blackspider.com/proxy.pac?p=77fhk63w
    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 *