Categorygithub.com/funcards/socket.io-parser/v5
package
5.0.0-20220531201732-0afad5700cf3
Repository: https://github.com/funcards/socket.io-parser.git
Documentation: pkg.go.dev

# README

socket.io-parser

workflow Coverage Status GoDoc License

socket.io encoder and decoder written in GO complying with version 5 of socket.io-protocol.

TODO: reconstruct binary on decode

Installation

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"

How to use

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...)

License

Distributed under MIT License, please see license file within the code for more details.