encode Ws Frame
Encodes the given EngineIOPacket to a string, which can be used as a text web socket frame body.
If this packet is a EngineIOPacket.Message packet, the payload is serialized using the provided serializePayload function.
This is meant to be used in web socket mode, where each web socket frame contains a single Engine.IO packet.