stream

package
v0.0.0-...-87d79fb Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package stream wraps connections to the Twitter STREAM API to simplify access.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*options)

Option configures aspects of the stream.

func AggressiveBackoff

func AggressiveBackoff(b *backoff.Backoff) Option

AggressiveBackoff returns an Option that sets the aggressive exponential backoff.

func ChannelOptions

func ChannelOptions(opts ...channel.Option) Option

ChannelOptions returns an Option that configures the internal channel with the given []channel.Option.

func ExponentialBackoff

func ExponentialBackoff(b *backoff.Backoff) Option

ExponentialBackoff returns an Option that sets the exponential backoff.

type Stream

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

Stream is a wrapper the simplifies access to the underlying HTTP client connected to the Twitter STREAM API.

func New

func New(client *http.Client, req *http.Request, opt ...Option) *Stream

New creates a new Stream that performs the given request on the given authenticated client.

func (*Stream) Err

func (s *Stream) Err() error

Err returns the stream error if any. Subsequent calls return the same error.

func (*Stream) Recv

func (s *Stream) Recv() <-chan interface{}

Recv provides raw access to the output of the stream. Useful when wanting to range over the output channel, or perform selection over many channels simultaneously.

func (*Stream) Stop

func (s *Stream) Stop()

Stop stops the Stream. Must be called if volentarily stopping the stream to allows the internal goroutine to exit.

Jump to

Keyboard shortcuts

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