Documentation ¶
Overview ¶
Package serialize provides a Serializer interface with implementations that encode and decode message data in various ways.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BinaryData ¶
type BinaryData []byte
Binary data follows a convention for conversion to JSON strings.
A byte array is converted to a JSON string as follows:
1. convert the byte array to a Base64 encoded (host language) string 2. prepend the string with a \0 character 3. serialize the string to a JSON string
func (BinaryData) MarshalJSON ¶
func (b BinaryData) MarshalJSON() ([]byte, error)
func (*BinaryData) UnmarshalJSON ¶
func (b *BinaryData) UnmarshalJSON(v []byte) error
type CBORSerializer ¶
type CBORSerializer struct{}
CBORSerializer is an implementation of Serializer that handles serializing and deserializing cbor encoded payloads.
func (*CBORSerializer) Deserialize ¶
func (s *CBORSerializer) Deserialize(data []byte) (wamp.Message, error)
Deserialize decodes a cbor payload into a Message.
type JSONSerializer ¶
type JSONSerializer struct{}
JSONSerializer is an implementation of Serializer that handles serializing and deserializing json encoded payloads.
func (*JSONSerializer) Deserialize ¶
func (s *JSONSerializer) Deserialize(data []byte) (wamp.Message, error)
Deserialize decodes a json payload into a Message.
type MessagePackSerializer ¶
type MessagePackSerializer struct{}
MessagePackSerializer is an implementation of Serializer that handles serializing and deserializing msgpack encoded payloads.
func (*MessagePackSerializer) Deserialize ¶
func (s *MessagePackSerializer) Deserialize(data []byte) (wamp.Message, error)
Deserialize decodes a msgpack payload into a Message.
type Serialization ¶
type Serialization int
Serialization indicates the data serialization format used in a WAMP session
const ( // Use JSON-encoded strings as a payload. JSON Serialization = iota // Use msgpack-encoded strings as a payload. MSGPACK // Use CBOR encoding as a payload CBOR )