Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var EventTypes = []EventType{EventType_Connect, EventType_Disconnect, EventType_Message}
Functions ¶
This section is empty.
Types ¶
type Ctx ¶
type Ctx struct {
Request Request
Response *Response
Extras map[string]interface{}
// contains filtered or unexported fields
}
func NewCtx ¶
func NewCtx(msg *websocketspb.ServerMessage) *Ctx
func (*Ctx) ToClientMessage ¶
func (c *Ctx) ToClientMessage() *websocketspb.ClientMessage
type Websocket ¶
type Websocket interface {
// Name - Get the name of the Websocket API
Name() string
// On registers a handler for a specific event type on the websocket
// Valid function signatures for handler are:
//
// func()
// func() error
// func(*websocket.Ctx)
// func(*websocket.Ctx) error
// Handler[websocket.Ctx]
On(eventType EventType, handler interface{})
// Send a message to a specific connection
Send(ctx context.Context, connectionId string, message []byte) error
// Close a specific connection
Close(ctx context.Context, connectionId string) error
}
Websocket - Nitric Websocket API Resource
func NewWebsocket ¶
NewWebsocket - Create a new Websocket API resource
Click to show internal directories.
Click to hide internal directories.