Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection[T any] struct { LWS *LazyWS[T] Storage *T // contains filtered or unexported fields }
func (*Connection[T]) Close ¶
func (conn *Connection[T]) Close() error
func (*Connection[T]) Handler ¶
func (conn *Connection[T]) Handler(data []byte)
func (*Connection[T]) Read ¶
func (conn *Connection[T]) Read() ([]byte, error)
func (*Connection[T]) ReadLoop ¶
func (conn *Connection[T]) ReadLoop()
func (*Connection[T]) Send ¶
func (conn *Connection[T]) Send(data []byte) error
type Context ¶
type Context[T any] struct { Event string Data json.RawMessage Conn *Connection[T] }
type EventHandler ¶
type EventHandler[T any] struct { // contains filtered or unexported fields }
func NewEventHandler ¶
func NewEventHandler[T any]() EventHandler[T]
func (*EventHandler[T]) Dispatch ¶
func (eh *EventHandler[T]) Dispatch(ctx Context[T])
func (*EventHandler[T]) On ¶
func (eh *EventHandler[T]) On(event string, handler EventHandlerFunction[T])
type EventHandlerFunction ¶
type LazyWS ¶
type LazyWS[T any] struct { EventHandler[T] Storage T // contains filtered or unexported fields }
type Message ¶
type Message struct { Event string `json:"event"` Data json.RawMessage `json:"data"` }
Click to show internal directories.
Click to hide internal directories.