client

package
v0.0.0-...-83e654d Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2017 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Start() error
	Close()

	Subscribe(path string) error
	Unsubscribe(path string) error

	Send(path string, body string, header string) error
	SendBytes(path string, body []byte, header string) error

	WriteRawMessage(message []byte) error
	Messages() chan *protocol.Message
	StatusMessages() chan *protocol.NotificationMessage
	Errors() chan *protocol.NotificationMessage

	SetWSConnectionFactory(WSConnectionFactory)
	IsConnected() bool
}

func New

func New(url, origin string, channelSize int, autoReconnect bool) Client

New creates a new client, without starting the connection

func Open

func Open(url, origin string, channelSize int, autoReconnect bool) (Client, error)

Open is a shortcut for New() and Start()

type WSConnection

type WSConnection interface {
	WriteMessage(messageType int, data []byte) error
	ReadMessage() (messageType int, p []byte, err error)
	Close() error
}

func DefaultConnectionFactory

func DefaultConnectionFactory(url string, origin string) (WSConnection, error)

type WSConnectionFactory

type WSConnectionFactory func(url string, origin string) (WSConnection, error)

Jump to

Keyboard shortcuts

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