Zaqar/specs/websockets

Current reasons of websockets not being available

 * Some firewalls and stuff are configured to kill HTTP connections after a certain amount of time. There is a real cost to persistent connections on networking gear, although that cost is going down, still significant
 * Some people may be paranoid from a security standpoint and they will kill any traffic over port 80 or 443 that doesn't look like HTTP. In this scenario you can have one org or company talking to another org or company and you have to have both parties agree to let this traffic through. Nowadays we expect it to work most of the time, but sometimes it won't.
 * Some clients (older web browsers, some languages) may not support WebSocket

Fallback approach
Falling back to long-polling if websocket is not enabled would be the best alternative, but it might not be as simple as it sounds from a pub-sub stand point. For this reason, we decided to fall back to short polling for now and leave that to be handled by the client and look at adding long-polling support later.

Messages serialization

 * Protobuf has support for Java, C++ and Python. No Javascript. Also, it requires an external compiler.
 * Msgpack has support for a ton of languages, we are covered in that aspect.
 * CapnProto implementation is for C++, other languages are being supported for people not related to the original project. Hmm.
 * Apache Avro has support for Java, C++, C#, Python, Ruby... https://cwiki.apache.org/confluence/display/AVRO/Supported+Languages. No Javascript.

Given our current needs, Msgpack is our first choice.

Websockets library
There are several alternatives to use for the implementation of this feature, including:


 * Autobahn: Websockets / WAMP on Twisted and asyncio. The server uses twisted which is something the OpenStack community has moved away from already.
 * SockJS: Raw websockets. Javascript library. Don't seem to be maintained, the problems related to CORS and the fallback process doesn't work that well.
 * SocketIO: Wrapper for WebSocket. Javascript library.
 * ws4py: Python package implementing the WebSocket protocol as defined in RFC 6455.

Since that we need raw websockets, we leaved Autobahn and SocketIO aside. And given that SocketIO doesn't have a non Javascript library, we decided to go for ws4py.