message

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageSerializer

type MessageSerializer struct {
	// contains filtered or unexported fields
}

func NewMessageSerializer

func NewMessageSerializer(messagePrefix []byte) *MessageSerializer

func (*MessageSerializer) Deserialize

func (ms *MessageSerializer) Deserialize(event []byte, websocketMessage []byte) (interface{}, error)

deserialize deserializes a custom websocket message from the client ex: go-websocket-message;chat;4;themarshaledstringfromajsonstruct will return 'hello' as string Supported data types are: string, int, bool, bytes and JSON.

func (*MessageSerializer) GetWebsocketCustomEvent

func (ms *MessageSerializer) GetWebsocketCustomEvent(websocketMessage []byte) []byte

getWebsocketCustomEvent return empty string when the websocketMessage is native message

func (*MessageSerializer) Serialize

func (ms *MessageSerializer) Serialize(event string, data interface{}) ([]byte, error)

websocketMessageSerialize serializes a custom websocket message from websocketServer to be delivered to the client returns the string form of the message Supported data types are: string, int, bool, bytes and JSON.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL