Documentation ¶
Overview ¶
Package faye is a client for the Faye protocol.
Faye protocol is licensed under The MIT License © 2009–2017 James Coglan. More on https://faye.jcoglan.com/.
Faye (Go) package is licensed under The MIT License © 2017 Arthur Corenzan. More on https://github.com/haggen/faye/.
Index ¶
Constants ¶
const ( HandshakeAdvice = "handshake" Retry = "retry" None = "none" )
Enumeration of reconnect advices.
const ( Handshake = "/meta/handshake" Connect = "/meta/connect" Disconnect = "/meta/disconnect" Subscribe = "/meta/subscribe" Unsubscribe = "/meta/unsubscribe" )
Enumeration of protocol channels.
const ( Unconnected = iota Connecting Connected Disconnected )
Enumeration of Client states.
const Version = "1.0"
Version of Faye protocol.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advice ¶
type Advice struct { // Interval in milliseconds between connection checks. Interval time.Duration `json:"interval"` // Timeout in milliseconds for requests. Timeout time.Duration `json:"timeout"` // Advice string. May be 'none', 'handshake', or 'retry'. Reconnect string `json:"reconnect"` }
Advice about what the server requires from the client.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the end-user interface with the protocol.
type Message ¶
type Message struct { ID int `json:"id"` Timestamp int64 `json:"timestamp"` Ext interface{} `json:"ext"` Data interface{} `json:"data"` Advice *Advice `json:"advice"` Version string `json:"version"` ClientID string `json:"clientId"` Channel string `json:"channel"` Error string `json:"error"` Successful bool `json:"successful"` Subscription string `json:"subscription"` SupportedConnectionTypes []string `json:"supportedConnectionTypes"` }
Message encode/decode both requests and responses.
type Transport ¶
type Transport interface { Connect(string) error Disconnect() error Send(*Message) error Receive() (*Message, error) ConnectionType() string Ping() }
Transport is the interface for communication with the server. e.g. WebSocket or Polling.
type WebSocket ¶
type WebSocket struct {
// contains filtered or unexported fields
}
WebSocket connects and communicates with the server via WebSocket.
func NewWebSocket ¶
NewWebSocket initializes and returns a new WebSocket transport.
func (*WebSocket) ConnectionType ¶
ConnectionType returns "websocket". This will be used when negoticating with the server the supported connection types.
func (*WebSocket) Disconnect ¶
Disconnect closes the connection to the WebSocket server.