client

package
Version: v0.0.0-...-9a1ef11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BayeuxHandler

type BayeuxHandler interface {
	HandleMessage(message []byte) error
	ReaderDisconnect()
}

BayeuxHandler is an interface responsible for parsing bayeux messages

type Client

type Client struct {
	Host        string
	MessageChan chan Message // any messages recv'd by the client will be sent to the message channel - TODO: remap this to a set of subscription message channels one per active subscription
	// contains filtered or unexported fields
}

Client manages a client connection and interactions

func NewClient

func NewClient(host string) *Client

NewClient returns and instance of Client

func (*Client) Disconnect

func (f *Client) Disconnect()

Disconnect disconnects from the Bayeux server

func (*Client) HandleMessage

func (f *Client) HandleMessage(message []byte) error

HandleMessage parses and interprets a bayeux message response

func (*Client) Publish

func (f *Client) Publish(channel string, data map[string]interface{}) error

Publish publishes a message to the Bayeux server

func (*Client) ReaderDisconnect

func (f *Client) ReaderDisconnect()

ReaderDisconnect - called by the connection handler if the reader connection is dropped by the loss of a server connection

func (*Client) SetKeepAliveIntervalSeconds

func (f *Client) SetKeepAliveIntervalSeconds(secs int)

func (*Client) Start

func (f *Client) Start(ready chan bool) error

func (*Client) Subscribe

func (f *Client) Subscribe(channel string) error

Subscribe sends a subscribe message for the given channel

func (*Client) Unsubscribe

func (f *Client) Unsubscribe(channel string) error

Unsubscribe sends an unsubscribe message for the given channel

func (*Client) Write

func (f *Client) Write(msg string) error

Write sends a message to the bayeux server over the websocket connection

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

Connection holds a websocket connnection and manages connection state

func NewConnection

func NewConnection(ws *websocket.Conn) *Connection

NewConnection instantiates and returns a new Connection object

func (*Connection) Connected

func (c *Connection) Connected() bool

Connected returns a bool indicating the connection state of both the reader and writer on the connection

type Message

type Message struct {
	Channel string
	Data    map[string]interface{}
	Ext     map[string]interface{}
}

Message represents a message recv'd via the bayeux connection

type Subscription

type Subscription struct {
	// contains filtered or unexported fields
}

Subscription is a subscription represents a subscription to a channel by the client Each sub has a path representing the channel on bayeux, a messageChan which is recieve any messages sent to it and a connected indicator to indicate the state of the sub on the bayeux server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL