Documentation ¶
Overview ¶
Package server implements the bayeux specific message handling and server logic for a bayeux backend server
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BayeuxMessage ¶
type BayeuxMessage struct { Channel string `json:"channel"` ClientID string `json:"clientId,omitempty"` Subscription string `json:"subscription,omitempty"` Data interface{} `json:"data,omitempty"` ID string `json:"id,omitempty"` SupportedConnectionTypes []string `json:"supportedConnectionTypes,omitempty"` }
BayeuxMessage represents an incoming Bayeux message along with the associated fields
type BayeuxResponse ¶
type BayeuxResponse struct { Channel string `json:"channel,omitempty"` Successful bool `json:"successful,omitempty"` Version string `json:"version,omitempty"` SupportedConnectionTypes []string `json:"supportedConnectionTypes,omitempty"` ConnectionType string `json:"connectionType,omitempty"` ClientID string `json:"clientId,omitempty"` Advice map[string]interface{} `json:"advice,omitempty"` Subscription string `json:"subscription,omitempty"` Error string `json:"error,omitempty"` ID string `json:"id,omitempty"` Data interface{} `json:"data,omitempty"` Ext interface{} `json:"ext,omitempty"` }
BayeuxResponse represents a Bayeux response message and all associated fields
type Client ¶
Client represents a connected Faye Client, each has an ID negotiated during handshake, a write channel tied to their network connection and a list of subscriptions(faye channels) that have been subscribed to by the client.
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection represents a websocket connection along with reader and writer state
type Server ¶
type Server struct { Connections []Connection Subscriptions map[string][]Client SubMutex sync.RWMutex Clients map[string]Client ClientMutex sync.RWMutex // contains filtered or unexported fields }
Server is the main Bayeux server object which manages connections, subscriptions and clients
func (*Server) DisconnectChannel ¶
DisconnectChannel disconnects from the given channel sending the bayeux disconnect message
func (*Server) HandleMessage ¶
HandleMessage is the core Bayeux message handler for the server, it interprets each bayeux message and triggers the appropriate response