Documentation ¶
Index ¶
- func Run(webPort int, natsEndpoint string)
- type Ack
- type AckCommand
- type Acks
- type AuthCommand
- type Client
- type ConnectionInfo
- type InboundCommand
- type NatsPublisher
- type PublishCommand
- type PublishEventCommand
- type Publisher
- type ReplayCommand
- type ReplayRange
- type SubscribeCommand
- type UnsubscribeCommand
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AckCommand ¶
type AckCommand struct { Acktype string `json:"acktype"` Channel string `json:"channel"` Error string `json:"error,omitempty"` Ref string `json:"ref"` }
AckCommand provides error responses to WS clients
type Acks ¶
type Acks struct {
// contains filtered or unexported fields
}
Acks a group of acks with syncs
func (*Acks) GC ¶
func (a *Acks) GC()
GC ranges over the sync map to clear out acks older than 5 minutes
func (*Acks) WaitForKey ¶
WaitForKey checks if a key exists otherwise waits for a change to the map and then checks again
type AuthCommand ¶
type AuthCommand struct { *InboundCommand Stream int32 `json:"stream"` Key string `json:"key"` Secret string `json:"secret"` }
AuthCommand provides streaming information and verification
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client maintains WS info
func (*Client) Subscribe ¶
func (c *Client) Subscribe(channel string, cmd *InboundCommand)
Subscribe opens a NATS subscription for the websocket
func (*Client) Unsubscribe ¶
func (c *Client) Unsubscribe(channel string, cmd *InboundCommand)
Unsubscribe closes a subscription to NATS
type ConnectionInfo ¶
ConnectionInfo basic information about the current connection
type InboundCommand ¶
InboundCommand is the basic struct for all commands coming from browser
type PublishCommand ¶
type PublishCommand struct { *SubscribeCommand Data string `json:"data"` Source string `json:"source"` Type string `json:"type"` TypeVersion string `json:"typeVersion"` ContentType string `json:"contentType"` Metadata map[string]string `json:"metadata"` }
PublishCommand sends data (server-side event) through to NATS
type PublishEventCommand ¶
type PublishEventCommand struct { *SubscribeCommand Event *event.Event `json:"event"` }
PublishEventCommand sends an client-side event through NATS
type ReplayCommand ¶
type ReplayCommand struct { *SubscribeCommand Stream int32 `json:"stream"` JustMe bool `json:"justme"` Dest string `json:"dest"` Query ReplayRange `json:"query"` }
ReplayCommand instructs events to rebroadcast all events stored since time
type ReplayRange ¶
type ReplayRange struct { StartTime *time.Time `json:"startTime"` EndTime *time.Time `json:"endTime"` EndID string `json:"endID"` }
ReplayRange specifies the time and/or ID's to include in the replay
type SubscribeCommand ¶
type SubscribeCommand struct { *InboundCommand Subject string `json:"subject"` }
SubscribeCommand starts a subscription
type UnsubscribeCommand ¶
type UnsubscribeCommand struct { *InboundCommand Subject string `json:"subject"` }
UnsubscribeCommand starts a subscription