Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Error for when sending a message fails. ErrTypeMsgSendfail = "msg_send_fail" // Error for when receiving a message fails. ErrTypeMsgReceiveFail = "msg_receive_fail" // Error for when a participant sends a request that requires that it // already joined a session. ErrTypeSessionNotJoined = "session_not_joined" // Error for when a message is received without a timestamp set. ErrTypeMsgMissingTimestamp = "msg_missing_timestamp" // Error for when a message is skipped by a module. ErrTypeMsgSkip = "module_msg_skip" // Error for when an entity does not exist. ErrEntityComponentTypeNotAdded = "entity-component-type-not-added" // Error for when an entity component type already exists. ErrEntityComponentTypeAlreadyAdded = "entity-component-type-already-added" )
Variables ¶
View Source
var ( // Error returned when a module skipped handling a message. ErrModuleMsgSkip = errors.New("handling message is skipped").WithType(ErrTypeMsgSkip) )
Functions ¶
func NewScheduler ¶
func NewScheduler() *scheduler
func ProtoMsgType ¶
ProtoMsgType returns the type of the protobuf message as a string.
It panics when msg does not have a GetType method that returns a protobuf error.
Types ¶
type Consumer ¶
type Consumer interface { // Returns the next message to be consumed. Consume(context.Context) (Msg, error) // Returns the channel that contains the consumable messages. Messages() <-chan Msg }
Consumer represents a message consumer.
type Dispatcher ¶
type Dispatcher interface { // Dispatches the given message. Dispatch(context.Context, Msg) error // The function called when a session frame ends. HandleFrame() }
Dispatcher represents a message dispatcher that decides if and when a message can be consumed.
type Msg ¶
type Msg struct { Type protoreflect.Enum Time time.Time // contains filtered or unexported fields }
Msg represents a Hagall WebSocket message to be handled.
func MsgFromProto ¶
MsgFromProto builds Msg from ProtoMsg.
func (Msg) TypeString ¶
type ProtoMsg ¶
type ProtoMsg interface { protoreflect.ProtoMessage GetTimestamp() *timestamppb.Timestamp }
ProtoMsg is the interface that describes a protobuf message.
type ResponseSender ¶
Click to show internal directories.
Click to hide internal directories.