Documentation ¶
Index ¶
- func DeleteChannel(id string)
- func GetMarketOrderbookSnapshotV2(fetcher SnapshotFetcher, marketID string) *common.SnapshotV2
- func RunChannel(c IChannel)
- func StartConsumer(ctx context.Context, queueConfig interface{})
- func StartSocketServer(ctx context.Context)
- type AddressChannel
- 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) Stop()
- func (c *Channel) SubScribeChan() chan *Client
- func (c *Channel) UnsubscribeChan() chan string
- type Client
- type ClientConn
- type ClientRequest
- type DefaultSnapshotFetcher
- type IChannel
- type MarketChannel
- type OnMessageResult
- type Orderbook
- type OrderbookLevel2Snapshot
- type OrderbookLevel2Update
- type SnapshotFetcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteChannel ¶
func DeleteChannel(id string)
func GetMarketOrderbookSnapshotV2 ¶
func GetMarketOrderbookSnapshotV2(fetcher SnapshotFetcher, marketID string) *common.SnapshotV2
func RunChannel ¶
func RunChannel(c IChannel)
func StartConsumer ¶
StartConsumer initializes a queue instance and ready events from it
func StartSocketServer ¶
Types ¶
type AddressChannel ¶
type AddressChannel struct {
*Channel
}
Special Implements of IChannel
func CreateAddressChannel ¶
func CreateAddressChannel(channelID string) *AddressChannel
type Channel ¶
type Channel struct { ID string Clients map[string]*Client Subscribe chan *Client Unsubscribe chan string Messages chan *common.WebSocketMessage }
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 Client struct { ID string Conn ClientConn Channels map[string]*Channel // contains filtered or unexported fields }
type ClientConn ¶
type ClientConn interface { WriteJSON(interface{}) error ReadJSON(interface{}) error RemoteAddr() net.Addr }
For Mock Test
type ClientRequest ¶
type DefaultSnapshotFetcher ¶
type DefaultSnapshotFetcher struct{}
func (*DefaultSnapshotFetcher) GetV2 ¶
func (*DefaultSnapshotFetcher) 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 Stop() // contains filtered or unexported methods }
func CreateChannelByID ¶
func FindChannel ¶
type MarketChannel ¶
func CreateMarketChannel ¶
func CreateMarketChannel(channelID, marketID string) *MarketChannel
type OnMessageResult ¶
type Orderbook ¶
func InitOrderbook ¶
type OrderbookLevel2Snapshot ¶
type OrderbookLevel2Snapshot struct { Type string `json:"type"` MarketID string `json:"marketID"` Bids [][2]string `json:"bids"` Asks [][2]string `json:"asks"` }
func NewOrderbookLevel2Snapshot ¶
func NewOrderbookLevel2Snapshot(marketID string, bids, asks [][2]string) *OrderbookLevel2Snapshot
type OrderbookLevel2Update ¶
type OrderbookLevel2Update struct { Type string `json:"type"` MarketID string `json:"marketID"` Price string `json:"price"` Side string `json:"side"` Amount string `json:"amount"` }
func NewOrderbookLevel2Update ¶
func NewOrderbookLevel2Update(marketID string, side, price, amount string) *OrderbookLevel2Update
type SnapshotFetcher ¶
type SnapshotFetcher interface {
GetV2(marketID string) *common.SnapshotV2
}
Click to show internal directories.
Click to hide internal directories.