Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Time allowed to write a message to the peer. WriteWait = 10 * time.Second // Time allowed to read the next pong message from the peer. PongWait = 60 * time.Second // Send pings to peer with this period. Must be less than pongWait. PingPeriod = (PongWait * 9) / 10 // Maximum message size allowed from peer. MaxMessageSize int64 = 64 * 1024 )
Functions ¶
Types ¶
type Client ¶
type Client struct { ID string Conn *websocket.Conn Pool *Pool Send chan interface{} // contains filtered or unexported fields }
func (*Client) NewPublishRequest ¶
func (c *Client) NewPublishRequest(m map[string]interface{}) *PublishRequest
func (*Client) NewSubscribeRequest ¶
func (c *Client) NewSubscribeRequest(m map[string]interface{}) *SubscribeRequest
func (*Client) ReadListen ¶ added in v1.0.0
func (c *Client) ReadListen()
func (*Client) WriteListen ¶ added in v1.0.0
func (c *Client) WriteListen()
type CloudEvent ¶
type CloudEvent struct { ID string `json:"id"` Source string `json:"source"` Type string `json:"type"` Data map[string]interface{} `json:"data"` DataContentType string `json:"datacontenttype"` Time int `json:"time"` SpecVersion string `json:"specversion"` Meta map[string]interface{} `json:"meta"` }
CloudEvent - https://github.com/cloudevents/spec/blob/v1.0.1/spec.md
type Message ¶
type Message interface {
// contains filtered or unexported methods
}
Message - Message duck type
type Pool ¶
type Pool struct { Subscribe chan SubscribeRequest Unsubscribe chan SubscribeRequest UnsubscribeAll chan SubscribeRequest Publish chan PublishRequest Subs map[string]*Sub Logging *logging.Logger }
Pool - Shared worker pool resources
func (*Pool) CacheManager ¶ added in v1.0.0
func (p *Pool) CacheManager()
CacheManager - Managers servers cache TODO: CacheManager
func (*Pool) Start ¶
func (p *Pool) Start()
Start - Go Routine runs worker with shared Pool resources.
func (*Pool) TakeSnapshot ¶ added in v1.0.0
func (p *Pool) TakeSnapshot()
TakeSnapshot - Takes Snapshot of Current State of Subscriptions. TODO: CacheManager
type PublishEvent ¶
type PublishEvent struct { Type string `json:"type"` Channels []string `json:"channels"` Event CloudEvent `json:"event"` }
PublishEvent - Publish incoming message type
func NewPublishEvent ¶
func NewPublishEvent(m map[string]interface{}) *PublishEvent
type PublishRequest ¶
type PublishRequest struct { PublishEvent Client *Client }
type Sub ¶ added in v1.0.0
type Sub struct { ID string // contains filtered or unexported fields }
Sub - Represents a Subscription
func (*Sub) AddNewChannels ¶ added in v1.0.0
AddNewChannels - Thread Safe method of adding new channels to Sub
func (*Sub) RemoveChannels ¶ added in v1.0.0
RemoveChannels - Thread Safe method of removing channels from Sub
type SubscribeMessage ¶
SubscribeMessage - Subscribe incoming message type
func NewSubscribeMessage ¶
func NewSubscribeMessage(m map[string]interface{}) *SubscribeMessage
type SubscribeRequest ¶
type SubscribeRequest struct { SubscribeMessage Client *Client }
Click to show internal directories.
Click to hide internal directories.