This is the GO parser version 4 for the engine.io protocol encoding.
Use go get.
go get github.com/funcards/engine.io-parser/v4
Then import the parser package into your own code.
import "github.com/funcards/engine.io-parser/v4"
The parser can encode/decode packets, payloads and payloads as binary.
Example:
payload := eiop.Payload{
{Type: eiop.Open},
{Type: eiop.Close},
{Type: eiop.Ping, Data: "probe"},
{Type: eiop.Pong, Data: "probe"},
{Type: eiop.Message, Data: "test"},
}
encoded := payload.Encode(&buf)
fmt.Println(encoded.(string))
payload1 = eiop.DecodePayload(encoded) // payload == payload1
Distributed under MIT License, please see license file within the code for more details.