I have an example of a websocket + ssl server running right now at: https://legionofevil.org
If you want to see the code, go ahead an skip these benchmarks.
Very Coarse Benchmarks
Previously, I was using xhr-polling with socket.io and was getting latency readings of about 120ms. My friends in the US were getting a 60ms lag reading (the server is in Utah, while I’m in British Columbia).
After recompiling nginx from the trunk source, I got speedups to about 55ms, which is half of what I was getting before. My US friends also reported a latency of 35ms.
So, ya. It’s worth an upgrade if you’re working with ssl.
Here’s a gist of my node server:
And the Nginx conf:
A couple of things to note here:
- Socket.io is automaticaly sending an “Upgrade” header for websockets.
- You don’t need to specify
wss://in your nginx configuration. As long as socket.io can upgrade to Http1.1, you should be fine.
I’ll be updating this entry with more info, but I’m sure this should get any intrepid hackers going.