realtime

package
v0.0.0-...-c384578 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2018 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	APIEndpoint string = "wss://ws.lightstream.bitflyer.com/json-rpc"

	HeartbeatIntervalSecond time.Duration = 60
	ReadTimeoutSecond       time.Duration = 300
	WriteTimeoutSecond      time.Duration = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel string
var (
	ChannelOrderBook       Channel = "lightning_board_snapshot"
	ChannelOrderBookUpdate Channel = "lightning_board"
	ChannelTicker          Channel = "lightning_ticker"
	ChannelExecution       Channel = "lightning_executions"
)

type ChannelMessage

type ChannelMessage struct {
	Channel Channel                 `json:"channel"`
	Message jsonencoding.RawMessage `json:"message"`
}

type Client

type Client struct {
	Endpoint string
	Session  *Session
}

func NewClient

func NewClient() *Client

func (*Client) APIEndpoint

func (c *Client) APIEndpoint() string

func (*Client) Connect

func (c *Client) Connect() (*Session, error)

type ExecutionHandler

type ExecutionHandler func(executions.Response) error

type Message

type Message struct {
	Version string         `json:"jsonrpc"`
	Method  string         `json:"method"`
	Params  ChannelMessage `json:"params"`
}

type OrderBookHandler

type OrderBookHandler func(board.Response) error

type OrderBookUpdateHandler

type OrderBookUpdateHandler func(board.Response) error

type RequestParam

type RequestParam struct {
	Channel Channel `json:"channel"`
}

type Session

type Session struct {
	Conn *websocket.Conn
}

func (*Session) Close

func (sess *Session) Close() error

type Subscriber

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

func NewSubscriber

func NewSubscriber() *Subscriber

func NewSubscriberWithOpts

func NewSubscriberWithOpts(opts *SubscriberOpts) *Subscriber

func (*Subscriber) HandleExecution

func (s *Subscriber) HandleExecution(
	pcs []markets.ProductCode,
	handler ExecutionHandler,
)

func (*Subscriber) HandleOrderBook

func (s *Subscriber) HandleOrderBook(
	pcs []markets.ProductCode,
	handler OrderBookHandler,
)

func (*Subscriber) HandleOrderBookUpdate

func (s *Subscriber) HandleOrderBookUpdate(
	pcs []markets.ProductCode,
	handler OrderBookUpdateHandler,
)

func (*Subscriber) HandleTicker

func (s *Subscriber) HandleTicker(
	pcs []markets.ProductCode,
	handler TickerHandler,
)

func (*Subscriber) ListenAndServe

func (s *Subscriber) ListenAndServe(sess *Session) error

type SubscriberOpts

type SubscriberOpts struct {
	Debug bool
}

type TickerHandler

type TickerHandler func(ticker.Response) error

Jump to

Keyboard shortcuts

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