Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sshaplygin/go-socket.io-parser
https://github.com/sshaplygin/go-socket.io-parser
client-parser golang parser socket-io socketio-parser
Last synced: 2 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/sshaplygin/go-socket.io-parser
- Owner: sshaplygin
- Created: 2020-05-14T18:44:40.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-05-18T01:11:14.000Z (over 2 years ago)
- Last Synced: 2024-11-14T00:41:13.055Z (2 months ago)
- Topics: client-parser, golang, parser, socket-io, socketio-parser
- Language: Go
- Homepage:
- Size: 101 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-socket.io-parser
## Documentation
- [parser](https://github.com/socketio/socket.io-parser)
- [docs](https://github.com/socketio/socket.io-protocol)### Encoding format:
```
[-][,][][JSON-stringified payload without binary]
+ binary attachment extracted
+ binary attachment extracted
```packet type consists of header + data.
`socketio_parser.encode()` -> `go_socketio_parser.Marshal(packet *parser.Packet) ([]byte, error)`
`socketio_parser.decode()` -> `go_socketio_parser.Unmarshal(data []byte, packet *parser.Packet) error`### Methods:
same approach as `encoding/json`:
Encode by custom writer:
```go
err := go_socketio_parser.NewEncoder(w io.Writer).Encode(packet *Packet)
```Decode by custom reader:
```go
err := go_socketio_parser.NewEncoder(r io.Reader).Decode(packet *Packet)
```## TODO
* Add validate test cases for invalid payload (link)[https://github.com/socketio/socket.io-parser/blob/main/test/parser.js#L134]
* Add streaming API
* Add inner structs
* Unit tests