templates

package
v0.0.0-...-226497a Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2014 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package templates contains template code for writing QP components, such as codecs and transports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Direct

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

Direct represents a qp.DirectTransport.

func NewDirect

func NewDirect() *Direct

NewDirect makes a new direct transport.

func (*Direct) OnMessage

func (d *Direct) OnMessage(channel string, handler qp.Handler) error

OnMessage binds the handler to the specified channel.

func (*Direct) Send

func (d *Direct) Send(channel string, data []byte) error

Send sends data on the channel.

func (*Direct) Start

func (d *Direct) Start() error

Start starts the transport.

func (*Direct) Stop

func (d *Direct) Stop(wait time.Duration)

Stop instructs the transport to gracefully stop and close the StopChan when stopping has completed.

In-flight requests will have "wait" duration to complete before being abandoned.

func (*Direct) StopChan

func (d *Direct) StopChan() <-chan stop.Signal

StopChan gets the stop channel which will block until stopping has completed, at which point it is closed. Callers should never close the stop channel.

type PubSub

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

PubSub represents a qp.PubSubTransport.

func NewPubSub

func NewPubSub() *PubSub

NewPubSub makes a new PubSub.

func (*PubSub) Publish

func (p *PubSub) Publish(channel string, data []byte) error

Publish publishes data on the specified channel.

func (*PubSub) Start

func (p *PubSub) Start() error

Start starts the transport.

func (*PubSub) Stop

func (p *PubSub) Stop(grace time.Duration)

Stop stops the transport and closes StopChan() when finished.

func (*PubSub) StopChan

func (p *PubSub) StopChan() <-chan stop.Signal

StopChan gets the stop channel which will be closed when this transport has successfully stopped.

func (*PubSub) Subscribe

func (p *PubSub) Subscribe(channel string, handler qp.Handler) error

Subscribe binds the handler to the specified channel.

Jump to

Keyboard shortcuts

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