Documentation
¶
Index ¶
Constants ¶
View Source
const ( CtrlAuth = "auth" CtrlSubscribe = "subscribe" CtrlUnsub = "unsubscribe" ConfirmPrefix = "confirmed:" RejectedPrefix = "rejected:" )
View Source
const ( ScopeWorkspace = "workspace" ScopeUser = "user" )
View Source
const ( CapBatch = "batch" CapNotification = "notification" CapWorkspace = "workspace" )
View Source
const ConnectedFrameType = "connected"
Variables ¶
This section is empty.
Functions ¶
func Capabilities ¶
func Capabilities() []string
func IsRegisteredScope ¶
func RegisterCapability ¶
func RegisterScope ¶
Types ¶
type ControlFrame ¶ added in v0.4.1
type ControlFrame struct {
Type string `json:"type"`
Token string `json:"token"`
Scope string `json:"scope"`
ID string `json:"id"`
Payload json.RawMessage `json:"payload"`
}
ControlFrame is the canonical decode target for inbound control frames (auth / subscribe / unsubscribe). Control fields are accepted from EITHER shape (F16): the flat form `{"type":"subscribe","scope":"task","id":"1"}` and the nested form `{"type":"subscribe","payload":{"scope":"task","id":"1"}}` — the JS WsClient's send() encodes the nested one. Top-level fields win when both are present.
func DecodeControl ¶ added in v0.4.1
func DecodeControl(raw []byte) (ControlFrame, bool)
DecodeControl parses a control frame and normalizes the nested payload into the flat fields: if Scope/ID/Token are empty at the top level, they are read out of payload when it is a JSON object.
Click to show internal directories.
Click to hide internal directories.