Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseMessage ¶
type BaseMessage struct { Event events.Event `json:"event"` Data json.RawMessage `json:"data"` }
The base message which wraps all event messages
func GenerateErrorMessage ¶
func GenerateErrorMessage(code int, message string) BaseMessage
helper func to create error messages which can be sent to the client
type BroadcastBuilder ¶
type BroadcastBuilder struct {
// contains filtered or unexported fields
}
func NewBroadcast ¶
func NewBroadcast() *BroadcastBuilder
func (*BroadcastBuilder) Build ¶
func (bb *BroadcastBuilder) Build() (*BroadcastMessage, error)
func (*BroadcastBuilder) Condition ¶
func (bb *BroadcastBuilder) Condition(condition func(interface{}) bool) *BroadcastBuilder
func (*BroadcastBuilder) Data ¶
func (bb *BroadcastBuilder) Data(unserialized any) *BroadcastBuilder
func (*BroadcastBuilder) Event ¶
func (bb *BroadcastBuilder) Event(event events.Event) *BroadcastBuilder
type BroadcastMessage ¶
type BroadcastMessage struct { Message BaseMessage Condition func(interface{}) bool }
message that only gets sent to players meeting the condition
type ErrorMessageData ¶
Generic error message we use
type MessageBuilder ¶
type MessageBuilder struct {
// contains filtered or unexported fields
}
func NewBaseMessage ¶
func NewBaseMessage() *MessageBuilder
func (*MessageBuilder) Build ¶
func (mb *MessageBuilder) Build() (*BaseMessage, error)
func (*MessageBuilder) Data ¶
func (mb *MessageBuilder) Data(unserialized any) *MessageBuilder
func (*MessageBuilder) Event ¶
func (mb *MessageBuilder) Event(event events.Event) *MessageBuilder
func (*MessageBuilder) ToBroadcast ¶
func (mb *MessageBuilder) ToBroadcast() *BroadcastBuilder
type Toast ¶
type Toast struct { Status ToastStatus `json:"status"` Message string `json:"message"` }
translates to a Toast() in the client
type ToastStatus ¶
type ToastStatus string
const ( SUCCESS ToastStatus = "success" INFO ToastStatus = "info" ERROR ToastStatus = "error" WARNING ToastStatus = "warning" )
Click to show internal directories.
Click to hide internal directories.