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