Testing WebSockets with CURL

Tuesday 23 June 2015

Just played around with Socket.io to access a backend service over WebSockets. As you might guess, it didn’t worked right from the beginning.

So, I wondered if there’s a way to test the backend with the good old curl command. And yes! There is!

$ curl -i -N \
-H "Connection: Upgrade" \
-H "Upgrade: websocket" \
-H "Host: localhost:8080" \
-H "Origin:http://localhost:8080" \

After starting, curl will wait and dump all messages that the server sends.

For related article, read the following:

A Code you can Maintain or High Productivity

I have been doing a little development lately in addition to my routine task. Something that’s struck me: checking a one-line code repair requires some minutes.

Development goes in stages between maintainable and productive, typically hitting among those extremes at the same time.

The art of programs moves rapidly. Some people have taken part in Rapid Application Development (RAD), where making a modification and getting it to production happens from an IDE (or not) and takes seconds. On the other hand, we’ve all seen catastrophic production interruptions, when some developer pushes a product to production that should not exist.

In other situations we’ve done extremely maintainable development where nothing is a one-line code change and releasing what would be a one-line code modification to production is an act of sheer will with a lot of moving pieces. The software world likes to do this and makes intricacy extremely well, thank you quite.

Take a historical example of RAD. In the Java world, JBuilder utilized to be able to release to Weblogic incrementally. In the PHP world, you could modify a file on the web server or locally, then SCP it into the ideal directory. In any case, you could quickly check that file locally. In the Microsoft world, back in the VB days, you could easily make a modification, then struck Run and test it once again. Microsoft still leads in the cloud era with the auto swap, however, let’s admit it, it ain’t like it used to be.

1 response to Testing WebSockets with CURL
  • Gordon Mitchell

    This website is really cool… Take me back to my old days.. Thanks and Keep it up!

Leave a comment

will not be published