vessel

package
v0.0.0-...-687348e Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2014 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel func(string, chan<- string, chan<- bool)

Channel is a function which takes a message, a channel for sending results, and a channel for signaling that the handler has completed.

type Persister

type Persister interface {
	Prepare() error
	SaveResult(string, *result) error
	SaveMessage(string, *message) error
	GetResult(string) (*result, error)
	GetMessages(string, int64) ([]*message, error)
}

func NewPersister

func NewPersister() Persister

type Vessel

type Vessel interface {
	// AddChannel registers the Channel handler with the specified name.
	AddChannel(string, Channel)

	// Start will start the server on the given ports.
	Start(string, string) error

	// Recv will handle a message by invoking any registered Channel handler.
	// It returns channels for receiving responses and checking if the message
	// handler has completed.
	Recv(*message) (<-chan string, <-chan bool, error)

	// Broadcast sends the specified message on the given channel to all connected clients.
	Broadcast(string, string)

	// Persister returns the Persister for this Vessel.
	Persister() Persister

	// URI returns the registered URI for this Vessel.
	URI() string
}

Vessel coordinates communication between clients and server. It's responsible for managing Channels and processing incoming and outgoing messages.

func NewSockJSVessel

func NewSockJSVessel(uri string) Vessel

NewSockJSVessel returns a new Vessel which relies on SockJS as the underlying transport.

Jump to

Keyboard shortcuts

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