Documentation
¶
Index ¶
Constants ¶
const ( RequestKeygen = 548658350 RequestPresence = 3869262148 )
const ( QueryType = 1 QueryActualKey = 2 // As opposed to 'emitter/' QueryTargetChannel = 3 )
Variables ¶
var ( ErrBadRequest = &EventError{code: 400, msg: "The request was invalid or cannot be otherwise served."} ErrPaymentRequired = &EventError{code: 402, msg: "The request can not be served, as the payment is required to proceed."} ErrForbidden = &EventError{code: 403, msg: "The request is understood, but it has been refused or access is not allowed."} ErrNotFound = &EventError{code: 404, msg: "The resource requested does not exist."} ErrServerError = &EventError{code: 500, msg: "An unexpected condition was encountered and no more specific message is suitable."} ErrNotImplemented = &EventError{code: 501, msg: "The server either does not recognize the request method, or it lacks the ability to fulfill the request."} )
Represents a set of errors used in the handlers.
Functions ¶
func ProcessKeyGen ¶
func TryProcessAPIRequest ¶
TryProcessAPIRequest attempts to generate the key and returns the result.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn represents an incoming connection.
func (*Conn) Unsubscribe ¶
Unsubscribe unsubscribes this client from a particular channel.
type EventError ¶
type EventError struct {
// contains filtered or unexported fields
}
EventError represents an event code which provides a more de.
type Service ¶
type Service struct { Closing chan bool // The channel for closing signal. Cipher *security.Cipher // The cipher to use for decoding and encoding keys. License *security.License // The licence for this emitter server. Config *config.Config // The configuration for the service. // contains filtered or unexported fields }
Service represents the main structure.
func NewService ¶
NewService creates a new service.
func (*Service) Broadcast ¶
Broadcast is used to broadcast a custom user event with a given name and payload. The events must be fairly small, and if the size limit is exceeded and error will be returned. If coalesce is enabled, nodes are allowed to coalesce this event.
type Ssid ¶
type Ssid []uint32
Ssid represents a subscription ID which contains a contract and a list of hashes for various parts of the channel.
func (Ssid) GetHashCode ¶
GetHashCode combines the ssid into a single hash.
type Subscribers ¶
type Subscribers []Subscriber
Subscribers represents a subscriber set which can contain only unique values.
func (*Subscribers) AddUnique ¶
func (s *Subscribers) AddUnique(value Subscriber)
AddUnique adds a subscriber to the set.
func (*Subscribers) Contains ¶
func (s *Subscribers) Contains(value Subscriber) bool
Contains checks whether a subscriber is in the set.
type Subscription ¶
type Subscription struct { Ssid Ssid // Gets or sets the SSID (parsed channel) for this subscription. Channel string // Gets or sets the channel for this subscription. Subscriber Subscriber // Gets or sets the subscriber for this subscription. }
Subscription represents a topic subscription.
type SubscriptionTrie ¶
type SubscriptionTrie struct {
// contains filtered or unexported fields
}
SubscriptionTrie represents an efficient collection of subscriptions with lookup capability.
func NewSubscriptionTrie ¶
func NewSubscriptionTrie() *SubscriptionTrie
NewSubscriptionTrie creates a new matcher for the subscriptions.
func (*SubscriptionTrie) Lookup ¶
func (c *SubscriptionTrie) Lookup(query Ssid) Subscribers
Lookup returns the Subscribers for the given topic.
func (*SubscriptionTrie) Subscribe ¶
func (c *SubscriptionTrie) Subscribe(ssid Ssid, channel string, sub Subscriber) (*Subscription, error)
Subscribe adds the Subscriber to the topic and returns a Subscription.
func (*SubscriptionTrie) Unsubscribe ¶
func (c *SubscriptionTrie) Unsubscribe(sub *Subscription)
Unsubscribe removes the Subscription.