-
Notifications
You must be signed in to change notification settings - Fork 2
/
type.go
38 lines (31 loc) · 1.18 KB
/
type.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package packet
import (
"io"
"github.com/zishang520/engine.io-go-parser/types"
)
type (
Type string
Options struct {
Compress bool `json:"compress" mapstructure:"compress" msgpack:"compress"`
WsPreEncoded types.BufferInterface `json:"wsPreEncoded,omitempty" mapstructure:"wsPreEncoded,omitempty" msgpack:"wsPreEncoded,omitempty"`
WsPreEncodedFrame types.BufferInterface `json:"wsPreEncodedFrame,omitempty" mapstructure:"wsPreEncodedFrame,omitempty" msgpack:"wsPreEncodedFrame,omitempty"`
}
Packet struct {
Type Type `json:"type" mapstructure:"type" msgpack:"type"`
Data io.Reader `json:"data,omitempty" mapstructure:"data,omitempty" msgpack:"data,omitempty"`
Options *Options `json:"options,omitempty" mapstructure:"options,omitempty" msgpack:"options,omitempty"`
// Deprecated: this method will be removed in the next major release, please use [Options.WsPreEncoded] instead.
WsPreEncoded types.BufferInterface
}
)
// Packet types.
const (
OPEN Type = "open"
CLOSE Type = "close"
PING Type = "ping"
PONG Type = "pong"
MESSAGE Type = "message"
UPGRADE Type = "upgrade"
NOOP Type = "noop"
ERROR Type = "error"
)