transport

package
v0.0.0-...-afe3fbd Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConnClosedErr      = "connection closed"
	InvalidResponseErr = "invalid response"
	InvalidRequestErr  = "invalid request"
	TimeoutErr         = "timeout"
)
View Source
const (
	DefaultTimeout = 5 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

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

func NewError

func NewError(name, reason string) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) Name

func (e *Error) Name() string

type HTTP

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

func (*HTTP) Request

func (t *HTTP) Request(resource string, params *requestparams.RequestParams, timeout time.Duration) ([]byte, *Error)

func (*HTTP) SetPollingResource

func (t *HTTP) SetPollingResource(subscriptionId, resource string)

func (*HTTP) SetPollingToken

func (t *HTTP) SetPollingToken(accessToken string)

func (*HTTP) Subscribe

func (t *HTTP) Subscribe(resource string, params *requestparams.RequestParams) (subscription *Subscription, subscriptionId string, err *Error)

func (*HTTP) Unsubscribe

func (t *HTTP) Unsubscribe(subscriptionId string)

type Params

type Params struct {
	ReconnectionTries    int
	ReconnectionInterval time.Duration
	DefaultTimeout       time.Duration
}

type Subscription

type Subscription struct {
	DataChan chan []byte
	ErrChan  chan error
	// contains filtered or unexported fields
}

func (*Subscription) ContinuePolling

func (s *Subscription) ContinuePolling()

type Transporter

type Transporter interface {
	Request(resource string, params *requestparams.RequestParams, timeout time.Duration) (res []byte, err *Error)
	Subscribe(resource string, params *requestparams.RequestParams) (subscription *Subscription, subscriptionId string, err *Error)
	Unsubscribe(subscriptionId string)
}

func Create

func Create(addr string, p *Params) (Transporter, error)

type WS

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

func (*WS) AfterReconnection

func (t *WS) AfterReconnection(callback func())

func (*WS) Request

func (t *WS) Request(resource string, params *requestparams.RequestParams, timeout time.Duration) ([]byte, *Error)

func (*WS) Resubscribe

func (t *WS) Resubscribe()

func (*WS) Subscribe

func (t *WS) Subscribe(resource string, params *requestparams.RequestParams) (subscription *Subscription, subscriptionId string, err *Error)

func (*WS) TerminateRequests

func (t *WS) TerminateRequests(err error)

func (*WS) Unsubscribe

func (t *WS) Unsubscribe(subscriptionId string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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