Documentation ¶
Index ¶
- func NewMarketChannelCreator(fetcher SnapshotFetcher) func(channelID string) IChannel
- func RegisterChannelCreator(prefix string, fn func(channelID string) IChannel)
- type Channel
- func (c *Channel) AddMessage(msg *common.WebSocketMessage)
- func (c *Channel) AddSubscriber(client *Client)
- func (c *Channel) GetID() string
- func (c *Channel) MessagesChan() chan *common.WebSocketMessage
- func (c *Channel) RemoveSubscriber(ID string)
- func (c *Channel) SubScribeChan() chan *Client
- func (c *Channel) UnsubscribeChan() chan string
- type Client
- type ClientRequest
- type DefaultHttpSnapshotFetcher
- type IChannel
- type OnMessageResult
- type Orderbook
- type SnapshotFetcher
- type WSServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMarketChannelCreator ¶
func NewMarketChannelCreator(fetcher SnapshotFetcher) func(channelID string) IChannel
func RegisterChannelCreator ¶
Types ¶
type Channel ¶
type Channel struct { ID string Clients map[string]*Client Subscribe chan *Client Unsubscribe chan string Messages chan *common.WebSocketMessage }
Channel is a basic type implemented IChannel
func (*Channel) AddMessage ¶
func (c *Channel) AddMessage(msg *common.WebSocketMessage)
func (*Channel) AddSubscriber ¶
func (*Channel) MessagesChan ¶
func (c *Channel) MessagesChan() chan *common.WebSocketMessage
func (*Channel) RemoveSubscriber ¶
func (*Channel) SubScribeChan ¶
func (*Channel) UnsubscribeChan ¶
type Client ¶
type ClientRequest ¶
type DefaultHttpSnapshotFetcher ¶
type DefaultHttpSnapshotFetcher struct {
ApiUrl string
}
func (*DefaultHttpSnapshotFetcher) GetV2 ¶
func (f *DefaultHttpSnapshotFetcher) GetV2(marketID string) *common.SnapshotV2
type IChannel ¶
type IChannel interface { GetID() string // Thread safe calls AddSubscriber(*Client) RemoveSubscriber(string) AddMessage(message *common.WebSocketMessage) UnsubscribeChan() chan string SubScribeChan() chan *Client MessagesChan() chan *common.WebSocketMessage // contains filtered or unexported methods }
type OnMessageResult ¶
type SnapshotFetcher ¶
type SnapshotFetcher interface {
GetV2(marketID string) *common.SnapshotV2
}
Click to show internal directories.
Click to hide internal directories.