types

package
v0.0.0-...-9cb16bd Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageTypeError = "error"

	// Health Check
	MessageTypeHealthCheck         = "health.check"
	MessageTypeConnectionConnected = "connection.connected"

	// Message
	MessageTypeMessageCreated = "message.created"

	// Room
	MessageTypeRoomUserJoined = "room.user.joined"
	MessageTypeRoomUserLeft   = "room.user.left"
	MessageTypeRoomEvent      = "room.event"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageType

type MessageType string

type WebsocketMessage

type WebsocketMessage struct {
	ConnectionID string `json:"connection_id"`

	// Message Type
	MessageType MessageType `json:"type"`

	// Message information
	Message interface{} `json:"message"`

	// Timestamps
	CreatedAt int64 `json:"created_at"`
}

func (*WebsocketMessage) New

func (w *WebsocketMessage) New(messageType MessageType)

New creates a new message entity

func (*WebsocketMessage) ToJson

func (w *WebsocketMessage) ToJson() []byte

ToJson converts the message entity to a json byte string

Jump to

Keyboard shortcuts

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