encode Socket IO
Encodes the given SocketIO packet (wrapped in an EngineIO packet) as a string.
The result can be directly used as a web socket text frame, unless it's a binary message. If the packet is a binary message, the resulting text can be sent as a web socket text frame, but must be followed by as many binary frames as there are binary attachments, in the order defined by their indices.
This is meant to be used in web socket mode, where each web socket frame contains a single Engine.IO packet.