Documentation ¶
Index ¶
- func AddClientSideHandler(ctx *h.RequestContext, event string, handler Handler) *h.AttributeMapOrdered
- func AddServerSideHandler(ctx *h.RequestContext, event string, handler Handler) *h.AttributeMapOrdered
- func BroadcastServerSideEvent(event string, value map[string]any)
- func Every(ctx *h.RequestContext, interval time.Duration, cb func() bool)
- func ManagerFromCtx(ctx *h.RequestContext) *wsutil.SocketManager
- func OnClick(ctx *h.RequestContext, handler Handler) *h.AttributeMapOrdered
- func OnClientEvent(ctx *h.RequestContext, eventName string, handler Handler) *h.AttributeMapOrdered
- func OnMouseOver(ctx *h.RequestContext, handler Handler) *h.AttributeMapOrdered
- func OnServerEvent(ctx *h.RequestContext, eventName string, handler Handler) h.Ren
- func Once(ctx *h.RequestContext, cb func())
- func PushElement(data HandlerData, el *h.Element) bool
- func PushElementCtx(ctx *h.RequestContext, el *h.Element) bool
- func PushServerSideEvent(data HandlerData, event string, value map[string]any)
- func RunOnConnected(ctx *h.RequestContext, cb func())
- func StartListener(locator *service.Locator)
- type Handler
- type HandlerData
- type HandlerMetrics
- type KeyHash
- type MessageHandler
- type Metrics
- type ServerSideEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddClientSideHandler ¶
func AddClientSideHandler(ctx *h.RequestContext, event string, handler Handler) *h.AttributeMapOrdered
func AddServerSideHandler ¶
func AddServerSideHandler(ctx *h.RequestContext, event string, handler Handler) *h.AttributeMapOrdered
func BroadcastServerSideEvent ¶
BroadcastServerSideEvent sends a server side event to all clients that have a handler for the event, not just the current session
func Every ¶
func Every(ctx *h.RequestContext, interval time.Duration, cb func() bool)
Every executes the given callback every interval, until the socket is disconnected, or the callback returns false.
func ManagerFromCtx ¶
func ManagerFromCtx(ctx *h.RequestContext) *wsutil.SocketManager
func OnClick ¶
func OnClick(ctx *h.RequestContext, handler Handler) *h.AttributeMapOrdered
func OnClientEvent ¶
func OnClientEvent(ctx *h.RequestContext, eventName string, handler Handler) *h.AttributeMapOrdered
func OnMouseOver ¶
func OnMouseOver(ctx *h.RequestContext, handler Handler) *h.AttributeMapOrdered
func OnServerEvent ¶
func Once ¶
func Once(ctx *h.RequestContext, cb func())
func PushElement ¶
func PushElement(data HandlerData, el *h.Element) bool
PushElement sends an element to the current session and swaps it into the page
func PushElementCtx ¶
func PushElementCtx(ctx *h.RequestContext, el *h.Element) bool
PushElementCtx sends an element to the current session and swaps it into the page
func PushServerSideEvent ¶
func PushServerSideEvent(data HandlerData, event string, value map[string]any)
PushServerSideEvent sends a server side event this specific session
func RunOnConnected ¶
func RunOnConnected(ctx *h.RequestContext, cb func())
func StartListener ¶
Types ¶
type Handler ¶
type Handler func(data HandlerData)
type HandlerData ¶
type HandlerData struct { SessionId session.Id Socket *wsutil.SocketConnection Manager *wsutil.SocketManager }
type HandlerMetrics ¶
type HandlerMetrics struct { TotalHandlers int ServerEventNamesToHashCount int SessionIdToHashesCount int }
func GetHandlerMetics ¶
func GetHandlerMetics() HandlerMetrics
type MessageHandler ¶
type MessageHandler struct {
// contains filtered or unexported fields
}
func NewMessageHandler ¶
func NewMessageHandler(manager *wsutil.SocketManager) *MessageHandler
func (*MessageHandler) OnClientSideEvent ¶
func (h *MessageHandler) OnClientSideEvent(handlerId string, sessionId session.Id)
func (*MessageHandler) OnDomElementRemoved ¶
func (h *MessageHandler) OnDomElementRemoved(handlerId string)
func (*MessageHandler) OnServerSideEvent ¶
func (h *MessageHandler) OnServerSideEvent(e ServerSideEvent)
func (*MessageHandler) OnSocketDisconnected ¶
func (h *MessageHandler) OnSocketDisconnected(event wsutil.SocketEvent)
type Metrics ¶
type Metrics struct { Manager wsutil.ManagerMetrics Handler HandlerMetrics }
func MetricsFromCtx ¶
func MetricsFromCtx(ctx *h.RequestContext) Metrics
Click to show internal directories.
Click to hide internal directories.