socket.io encoder and decoder written in GO complying with version 5
of socket.io-protocol.
Use go get.
go get github.com/funcards/socket.io-parser/v5
Then import the parser package into your own code.
import "github.com/funcards/socket.io-parser/v5"
The parser can encode/decode packets, payloads and payloads as binary.
Example:
packet := siop.Packet{
Type: siop.Connect,
Nsp: "/posts",
Data: map[string]string{
"sid": "unique-id",
},
}
encoded := packet.Encode()
fmt.Println(encoded[0].(string))
fn := func(pkt Packet) {
fmt.Println(pkt)
}
err := siop.Decode(fn, encoded...)
Distributed under MIT License, please see license file within the code for more details.