Documentation
¶
Overview ¶
Package event defines event types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeOrPanic ¶
EncodeOrPanic is a helper function to encode a JSON payload on the fly skipping the error check. Panics if the error occurs.
Types ¶
type EventAction ¶
type EventAction int
EventAction is a domain of possible actions. The core server can declare custom event action.
const ( // Server events. CLIENTS_COUNTER EventAction = iota ADD_CLIENT REMOVE_CLIENT REDIRECT ADD_ROOM REMOVE_ROOM UPDATE_ROOM // Client events. CHAT )
type ExternalEvent ¶
type ExternalEvent struct {
// Concrette payload type depends on event action.
Payload json.RawMessage `json:"p"`
ClientId string `json:"-"`
RoomId string `json:"-"`
Action EventAction `json:"a"`
}
ExternalEvent represents an event type which is exchanged between the Gatekeeper and clients.
type InternalEvent ¶
type InternalEvent struct {
// Concrette payload type depends on event action.
Payload json.RawMessage `json:"p"`
// Sender id.
ClientId string `json:"cid"`
// Room which will recieve an event.
RoomId string `json:"rid"`
Action EventAction `json:"a"`
}
InternalEvent represents an event type which is exchanged between the Gatekeeper and the core server. Internal event contains metadata which helps to identify the sender and route the room which will handle it.
Click to show internal directories.
Click to hide internal directories.