fayeclient

package
v0.0.0-...-62f173d Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2016 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	StateWSDisconnected   = iota // == 0
	StateWSConnected      = iota
	StateFayeDisconnected = iota
	StateFayeConnected    = iota
)
View Source
const DEFAULT_HOST = "localhost:4001/faye"
View Source
const DEFAULT_KEEP_ALIVE_SECS = 30

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientMessage

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

type ClientSubscription

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

==========================================

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

type Connection

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

func NewConnection

func NewConnection(ws *websocket.Conn) *Connection

func (*Connection) Connected

func (c *Connection) Connected() bool

type FayeClient

type FayeClient struct {
	Host        string
	MessageChan chan ClientMessage // 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
}

==========================================

func NewFayeClient

func NewFayeClient(host string) *FayeClient

func (*FayeClient) Disconnect

func (f *FayeClient) Disconnect()

func (*FayeClient) HandleMessage

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

Parse and interpret a faye message response

func (*FayeClient) Publish

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

func (*FayeClient) ReaderDisconnect

func (f *FayeClient) ReaderDisconnect()

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

func (*FayeClient) SetKeepAliveIntervalSeconds

func (f *FayeClient) SetKeepAliveIntervalSeconds(secs int)

func (*FayeClient) Start

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

func (*FayeClient) Subscribe

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

func (*FayeClient) Unsubscribe

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

func (*FayeClient) Write

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

Write a message to the faye server over the websocket connection

type FayeHandler

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

interface responsible for parsing faye messages

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL