Documentation ¶
Index ¶
- type ActionType
- type EventItem
- type LocalWebsocketService
- func (r *LocalWebsocketService) CloseConnection(ctx context.Context, req *nitricws.WebsocketCloseConnectionRequest) (*nitricws.WebsocketCloseConnectionResponse, error)
- func (r *LocalWebsocketService) GetState() State
- func (r *LocalWebsocketService) HandleEvents(stream nitricws.WebsocketHandler_HandleEventsServer) error
- func (r *LocalWebsocketService) RegisterConnection(socket string, connectionId string, connection *websocket.Conn) error
- func (r *LocalWebsocketService) SendMessage(ctx context.Context, req *nitricws.WebsocketSendRequest) (*nitricws.WebsocketSendResponse, error)
- func (r *LocalWebsocketService) SetServers(server map[string]string)
- func (r *LocalWebsocketService) SocketDetails(ctx context.Context, req *nitricws.WebsocketDetailsRequest) (*nitricws.WebsocketDetailsResponse, error)
- func (r *LocalWebsocketService) SubscribeToAction(subscription func(WebsocketAction[EventItem]))
- func (r *LocalWebsocketService) SubscribeToState(subscription func(map[string]map[string][]nitricws.WebsocketEventType))
- type State
- type WebsocketAction
- type WebsocketInfo
- type WebsocketMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionType ¶
type ActionType string
const ( INFO ActionType = "info" MESSAGE ActionType = "message" )
type EventItem ¶
type EventItem interface { WebsocketMessage | WebsocketInfo | any }
type LocalWebsocketService ¶
type LocalWebsocketService struct { *websockets.WebsocketManager // contains filtered or unexported fields }
func NewLocalWebsocketService ¶
func NewLocalWebsocketService() (*LocalWebsocketService, error)
func (*LocalWebsocketService) CloseConnection ¶
func (r *LocalWebsocketService) CloseConnection(ctx context.Context, req *nitricws.WebsocketCloseConnectionRequest) (*nitricws.WebsocketCloseConnectionResponse, error)
func (*LocalWebsocketService) GetState ¶
func (r *LocalWebsocketService) GetState() State
func (*LocalWebsocketService) HandleEvents ¶
func (r *LocalWebsocketService) HandleEvents(stream nitricws.WebsocketHandler_HandleEventsServer) error
func (*LocalWebsocketService) RegisterConnection ¶
func (*LocalWebsocketService) SendMessage ¶
func (r *LocalWebsocketService) SendMessage(ctx context.Context, req *nitricws.WebsocketSendRequest) (*nitricws.WebsocketSendResponse, error)
func (*LocalWebsocketService) SetServers ¶
func (r *LocalWebsocketService) SetServers(server map[string]string)
func (*LocalWebsocketService) SocketDetails ¶
func (r *LocalWebsocketService) SocketDetails(ctx context.Context, req *nitricws.WebsocketDetailsRequest) (*nitricws.WebsocketDetailsResponse, error)
func (*LocalWebsocketService) SubscribeToAction ¶
func (r *LocalWebsocketService) SubscribeToAction(subscription func(WebsocketAction[EventItem]))
func (*LocalWebsocketService) SubscribeToState ¶
func (r *LocalWebsocketService) SubscribeToState(subscription func(map[string]map[string][]nitricws.WebsocketEventType))
type State ¶
type State = map[socketName]map[serviceName][]nitricws.WebsocketEventType
type WebsocketAction ¶
type WebsocketAction[Event EventItem] struct { Name string `json:"name"` Event Event `json:"event"` Type ActionType `json:"-"` }
type WebsocketInfo ¶
type WebsocketInfo struct { ConnectionCount int `json:"connectionCount,omitempty"` Messages []WebsocketMessage `json:"messages,omitempty"` }
Click to show internal directories.
Click to hide internal directories.