Documentation ¶
Overview ¶
Faye Server
TODO: factor out the code and clean things up a little, commit - works with firefox/chrome/safari on mac with long-polling/eventsource support TODO: pure long-polling TODO: callback-polling TODO: cross-origin-polling
Created by Paul Crawford Copyright (c) 2013. All rights reserved.
Index ¶
Constants ¶
View Source
const CHANNEL_CONNECT = "/meta/connect"
View Source
const CHANNEL_DISCONNECT = "/meta/disconnect"
View Source
const CHANNEL_HANDSHAKE = "/meta/handshake"
View Source
const CHANNEL_SUBSCRIBE = "/meta/subscribe"
View Source
const CHANNEL_UNSUBSCRIBE = "/meta/unsubscribe"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
Client
Clients represent connected Faye Clients, 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
}
type FayeMessage ¶
type FayeMessage 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"` }
type FayeResponse ¶
type FayeResponse 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"` }
type FayeServer ¶
type FayeServer struct { Connections []Connection Subscriptions map[string][]Client SubMutex sync.RWMutex Clients map[string]Client ClientMutex sync.RWMutex // contains filtered or unexported fields }
func (*FayeServer) DisconnectChannel ¶
func (f *FayeServer) DisconnectChannel(c chan []byte)
func (*FayeServer) HandleMessage ¶
func (f *FayeServer) HandleMessage(message []byte, c chan []byte) ([]byte, error)
func (*FayeServer) UpdateClientChannel ¶
func (f *FayeServer) UpdateClientChannel(clientId string, c chan []byte) bool
updateClientChannel
Click to show internal directories.
Click to hide internal directories.