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.
Click to show internal directories.
Click to hide internal directories.