ws

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TradeChannel        = "trades"
	RawOrderBookChannel = "raw_orderbook"
	OrderChannel        = "orders"
	OrderBookChannel    = "orderbook"
	TokenChannel        = "tokens"
	OHLCVChannel        = "ohlcv"
	PriceBoardChannel   = "price_board"
	DepositChannel      = "deposit"
	MarketsChannel      = "markets"
	NotificationChannel = "notification"

	// Lending channel
	LendingOrderChannel        = "lending_orders"
	LendingTradeChannel        = "lending_trades"
	RawLendingOrderBookChannel = "raw_lending_orderbook"
	LendingOrderBookChannel    = "lending_orderbook"
	LendingOhlcvChannel        = "lending_ohlcv"
	LendingMarketsChannel      = "lending_markets"
	LendingPriceBoardChannel   = "lending_price_board"
)

Variables

This section is empty.

Functions

func ConnectionEndpoint

func ConnectionEndpoint(w http.ResponseWriter, r *http.Request)

ConnectionEndpoint is the the handleFunc function for websocket connections It handles incoming websocket messages and routes the message according to channel parameter in channelMessage

func DepositSocketUnsubscribeHandler

func DepositSocketUnsubscribeHandler(a common.Address) func(client *Client)

func LendingOrderSocketUnsubscribeHandler added in v1.2.0

func LendingOrderSocketUnsubscribeHandler(a common.Address) func(client *Client)

LendingOrderSocketUnsubscribeHandler unsubscrible order

func NotificationSocketUnsubscribeHandler

func NotificationSocketUnsubscribeHandler(a common.Address) func(client *Client)

NotificationSocketUnsubscribeHandler unsubscribe notification

func OrderSocketUnsubscribeHandler

func OrderSocketUnsubscribeHandler(a common.Address) func(client *Client)

OrderSocketUnsubscribeHandler unsubscrible order

func RegisterChannel

func RegisterChannel(channel string, fn func(interface{}, *Client)) error

func RegisterConnectionUnsubscribeHandler

func RegisterConnectionUnsubscribeHandler(c *Client, fn func(*Client))

RegisterConnectionUnsubscribeHandler needs to be called whenever a connection subscribes to a new channel. At the time of connection closing the ConnectionUnsubscribeHandler handlers associated with that connection are triggered.

func RegisterDepositConnection

func RegisterDepositConnection(a common.Address, c *Client)

RegisterDepositConnection registers a connection with and depositID. It is called whenever a message is recieved over deposit channel

func RegisterLendingOrderConnection added in v1.2.0

func RegisterLendingOrderConnection(a common.Address, c *Client)

RegisterLendingOrderConnection registers a connection with and orderID. It is called whenever a message is recieved over order channel

func RegisterNotificationConnection

func RegisterNotificationConnection(a common.Address, c *Client)

RegisterNotificationConnection registers a connection with an user address It is called whenever a message is received over notification channel

func RegisterOrderConnection

func RegisterOrderConnection(a common.Address, c *Client)

RegisterOrderConnection registers a connection with and orderID. It is called whenever a message is recieved over order channel

func SendDepositMessage

func SendDepositMessage(msgType types.SubscriptionEvent, a common.Address, payload interface{})

func SendLendingOrderMessage added in v1.2.0

func SendLendingOrderMessage(msgType types.SubscriptionEvent, a common.Address, payload interface{})

SendLendingOrderMessage send lending order message

func SendNotificationErrorMessage

func SendNotificationErrorMessage(c *Client, data interface{})

SendNotificationErrorMessage sends error message on markets channel

func SendNotificationMessage

func SendNotificationMessage(msgType types.SubscriptionEvent, a common.Address, payload interface{})

func SendOrderMessage

func SendOrderMessage(msgType types.SubscriptionEvent, a common.Address, payload interface{})

Types

type Client

type Client struct {
	*websocket.Conn
	// contains filtered or unexported fields
}

func NewClient

func NewClient(c *websocket.Conn) *Client

func (*Client) SendLendingOrderErrorMessage added in v1.2.0

func (c *Client) SendLendingOrderErrorMessage(err error, h common.Hash)

SendLendingOrderErrorMessage send error lending transaction

func (*Client) SendMessage

func (c *Client) SendMessage(channel string, msgType types.SubscriptionEvent, payload interface{}, h ...common.Hash)

SendMessage constructs the message with proper structure to be sent over websocket

func (*Client) SendOrderErrorMessage

func (c *Client) SendOrderErrorMessage(err error, h common.Hash)

func (*Client) SendPingMessage added in v1.2.2

func (c *Client) SendPingMessage() error

SendPingMessage check conntection

type DepositConnection

type DepositConnection []*Client

Send update directly to client based on wallet address

func GetDepositConnections

func GetDepositConnections(a common.Address) DepositConnection

GetDepositConn returns the connection associated with an deposit ID

type LendingMarketsSocket added in v1.2.0

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

LendingMarketsSocket holds the map of subscriptions subscribed to markets channels corresponding to the key/event they have subscribed to.

func GetLendingMarketSocket added in v1.2.0

func GetLendingMarketSocket() *LendingMarketsSocket

GetLendingMarketSocket return singleton instance of LendingMarketsSocket type struct

func NewLendingMarketsSocket added in v1.2.0

func NewLendingMarketsSocket() *LendingMarketsSocket

NewLendingMarketsSocket new lending market socket

func (*LendingMarketsSocket) BroadcastMessage added in v1.2.0

func (s *LendingMarketsSocket) BroadcastMessage(channelID string, p interface{}) error

BroadcastMessage streams message to all the subscriptions subscribed to the pair

func (*LendingMarketsSocket) SendErrorMessage added in v1.2.0

func (s *LendingMarketsSocket) SendErrorMessage(c *Client, data interface{})

SendErrorMessage sends error message on markets channel

func (*LendingMarketsSocket) SendInitMessage added in v1.2.0

func (s *LendingMarketsSocket) SendInitMessage(c *Client, data interface{})

SendInitMessage sends INIT message on markets channel on subscription event

func (*LendingMarketsSocket) SendMessage added in v1.2.0

func (s *LendingMarketsSocket) SendMessage(c *Client, msgType types.SubscriptionEvent, p interface{})

SendMessage sends a websocket message on the markets channel

func (*LendingMarketsSocket) SendUpdateMessage added in v1.2.0

func (s *LendingMarketsSocket) SendUpdateMessage(c *Client, data interface{})

SendUpdateMessage sends UPDATE message on markets channel as new data is created

func (*LendingMarketsSocket) Subscribe added in v1.2.0

func (s *LendingMarketsSocket) Subscribe(channelID string, c *Client) error

Subscribe handles the subscription of connection to get streaming data over the socker for any pair.

func (*LendingMarketsSocket) Unsubscribe added in v1.2.0

func (s *LendingMarketsSocket) Unsubscribe(c *Client)

Unsubscribe Unsubscribe a connection from a certain markets channel id

func (*LendingMarketsSocket) UnsubscribeChannel added in v1.2.0

func (s *LendingMarketsSocket) UnsubscribeChannel(channelID string, c *Client)

UnsubscribeChannel removes a websocket connection from the markets channel updates

func (*LendingMarketsSocket) UnsubscribeChannelHandler added in v1.2.0

func (s *LendingMarketsSocket) UnsubscribeChannelHandler(channelID string) func(c *Client)

UnsubscribeChannelHandler unsubscribes a connection from a certain markets channel id

func (*LendingMarketsSocket) UnsubscribeHandler added in v1.2.0

func (s *LendingMarketsSocket) UnsubscribeHandler() func(c *Client)

UnsubscribeHandler unsubscribes a connection from a certain markets channel id

type LendingOhlcvSocket added in v1.2.0

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

LendingOhlcvSocket holds the map of subscribtions subscribed to OHLCV channels corresponding to the key/event they have subscribed to.

func GetLendingOhlcvSocket added in v1.2.0

func GetLendingOhlcvSocket() *LendingOhlcvSocket

GetLendingOhlcvSocket return singleton instance of LendingOhlcvSocket type struct

func NewLendingOhlcvSocket added in v1.2.0

func NewLendingOhlcvSocket() *LendingOhlcvSocket

NewLendingOhlcvSocket create new instance

func (*LendingOhlcvSocket) BroadcastLendingOhlcv added in v1.2.0

func (s *LendingOhlcvSocket) BroadcastLendingOhlcv(channelID string, p interface{}) error

BroadcastLendingOhlcv Message streams message to all the subscriptions subscribed to the pair

func (*LendingOhlcvSocket) SendErrorMessage added in v1.2.0

func (s *LendingOhlcvSocket) SendErrorMessage(c *Client, p interface{})

SendErrorMessage sends an error message on the trade channel

func (*LendingOhlcvSocket) SendInitMessage added in v1.2.0

func (s *LendingOhlcvSocket) SendInitMessage(c *Client, p interface{})

SendInitMessage is responsible for sending message on trade channel at subscription

func (*LendingOhlcvSocket) SendMessage added in v1.2.0

func (s *LendingOhlcvSocket) SendMessage(c *Client, msgType types.SubscriptionEvent, p interface{})

SendMessage sends a websocket message on the trade channel

func (*LendingOhlcvSocket) SendUpdateMessage added in v1.2.0

func (s *LendingOhlcvSocket) SendUpdateMessage(c *Client, p interface{})

SendUpdateMessage is responsible for sending message on trade channel at subscription

func (*LendingOhlcvSocket) Subscribe added in v1.2.0

func (s *LendingOhlcvSocket) Subscribe(channelID string, c *Client) error

Subscribe handles the registration of connection to get streaming data over the socket for any pair.

func (*LendingOhlcvSocket) Unsubscribe added in v1.2.0

func (s *LendingOhlcvSocket) Unsubscribe(c *Client)

Unsubscribe returns function of type unsubscribe handler

func (*LendingOhlcvSocket) UnsubscribeChannel added in v1.2.0

func (s *LendingOhlcvSocket) UnsubscribeChannel(channelID string, c *Client)

UnsubscribeChannel is used to unsubscribe the connection from listening to the key subscribed to. It can be called on unsubscription message from user or due to some other reason by system

func (*LendingOhlcvSocket) UnsubscribeChannelHandler added in v1.2.0

func (s *LendingOhlcvSocket) UnsubscribeChannelHandler(channelID string) func(c *Client)

UnsubscribeChannelHandler returns function of type unsubscribe handler, it handles the unsubscription of pair in case of connection closing.

func (*LendingOhlcvSocket) UnsubscribeHandler added in v1.2.0

func (s *LendingOhlcvSocket) UnsubscribeHandler() func(c *Client)

UnsubscribeHandler returns function of type unsubscribe handler

type LendingOrderBookSocket added in v1.2.0

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

LendingOrderBookSocket holds the map of subscriptions subscribed to orderbook channels corresponding to the key/event they have subscribed to.

func GetLendingOrderBookSocket added in v1.2.0

func GetLendingOrderBookSocket() *LendingOrderBookSocket

GetLendingOrderBookSocket return singleton instance of LendingOrderBookSocket type struct

func NewLendingOrderBookSocket added in v1.2.0

func NewLendingOrderBookSocket() *LendingOrderBookSocket

NewLendingOrderBookSocket new lending order book instance

func (*LendingOrderBookSocket) BroadcastMessage added in v1.2.0

func (s *LendingOrderBookSocket) BroadcastMessage(channelID string, p interface{}) error

BroadcastMessage streams message to all the subscribtions subscribed to the pair

func (*LendingOrderBookSocket) SendErrorMessage added in v1.2.0

func (s *LendingOrderBookSocket) SendErrorMessage(c *Client, data interface{})

SendErrorMessage sends error message on orderbook channel

func (*LendingOrderBookSocket) SendInitMessage added in v1.2.0

func (s *LendingOrderBookSocket) SendInitMessage(c *Client, data interface{})

SendInitMessage sends INIT message on orderbook channel on subscription event

func (*LendingOrderBookSocket) SendMessage added in v1.2.0

func (s *LendingOrderBookSocket) SendMessage(c *Client, msgType types.SubscriptionEvent, p interface{})

SendMessage sends a websocket message on the orderbook channel

func (*LendingOrderBookSocket) SendUpdateMessage added in v1.2.0

func (s *LendingOrderBookSocket) SendUpdateMessage(c *Client, data interface{})

SendUpdateMessage sends UPDATE message on orderbook channel as new data is created

func (*LendingOrderBookSocket) Subscribe added in v1.2.0

func (s *LendingOrderBookSocket) Subscribe(channelID string, c *Client) error

Subscribe handles the subscription of connection to get streaming data over the socker for any pair. pair := utils.GetPairKey(bt, qt)

func (*LendingOrderBookSocket) Unsubscribe added in v1.2.0

func (s *LendingOrderBookSocket) Unsubscribe(c *Client)

Unsubscribe unsubscribe

func (*LendingOrderBookSocket) UnsubscribeChannel added in v1.2.0

func (s *LendingOrderBookSocket) UnsubscribeChannel(channelID string, c *Client)

UnsubscribeChannel removes a websocket connection from the orderbook channel updates

func (*LendingOrderBookSocket) UnsubscribeChannelHandler added in v1.2.0

func (s *LendingOrderBookSocket) UnsubscribeChannelHandler(channelID string) func(c *Client)

UnsubscribeChannelHandler unsubscribes a connection from a certain orderbook channel id

func (*LendingOrderBookSocket) UnsubscribeHandler added in v1.2.0

func (s *LendingOrderBookSocket) UnsubscribeHandler() func(c *Client)

UnsubscribeHandler unsubscribe lending orderbook handler

type LendingOrderConnection added in v1.2.0

type LendingOrderConnection []*Client

LendingOrderConnection array for lending connections

func GetLendingOrderConnections added in v1.2.0

func GetLendingOrderConnections(a common.Address) LendingOrderConnection

GetLendingOrderConnections returns the connection associated with an order ID

type LendingPriceBoardSocket added in v1.2.0

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

LendingPriceBoardSocket holds the map of subscriptions subscribed to price board channels corresponding to the key/event they have subscribed to.

func GetLendingPriceBoardSocket added in v1.2.0

func GetLendingPriceBoardSocket() *LendingPriceBoardSocket

GetLendingPriceBoardSocket return singleton instance of LendingPriceBoardSocket type struct

func NewLendingPriceBoardSocket added in v1.2.0

func NewLendingPriceBoardSocket() *LendingPriceBoardSocket

func (*LendingPriceBoardSocket) BroadcastMessage added in v1.2.0

func (s *LendingPriceBoardSocket) BroadcastMessage(channelID string, p interface{}) error

BroadcastMessage streams message to all the subscriptions subscribed to the pair

func (*LendingPriceBoardSocket) SendErrorMessage added in v1.2.0

func (s *LendingPriceBoardSocket) SendErrorMessage(c *Client, data interface{})

SendErrorMessage sends error message on price board channel

func (*LendingPriceBoardSocket) SendInitMessage added in v1.2.0

func (s *LendingPriceBoardSocket) SendInitMessage(c *Client, data interface{})

SendInitMessage sends INIT message on price board channel on subscription event

func (*LendingPriceBoardSocket) SendMessage added in v1.2.0

func (s *LendingPriceBoardSocket) SendMessage(c *Client, msgType types.SubscriptionEvent, p interface{})

SendMessage sends a websocket message on the price board channel

func (*LendingPriceBoardSocket) SendUpdateMessage added in v1.2.0

func (s *LendingPriceBoardSocket) SendUpdateMessage(c *Client, data interface{})

SendUpdateMessage sends UPDATE message on price board channel as new data is created

func (*LendingPriceBoardSocket) Subscribe added in v1.2.0

func (s *LendingPriceBoardSocket) Subscribe(channelID string, c *Client) error

Subscribe handles the subscription of connection to get streaming data over the socker for any pair.

func (*LendingPriceBoardSocket) Unsubscribe added in v1.2.0

func (s *LendingPriceBoardSocket) Unsubscribe(c *Client)

func (*LendingPriceBoardSocket) UnsubscribeChannel added in v1.2.0

func (s *LendingPriceBoardSocket) UnsubscribeChannel(channelID string, c *Client)

UnsubscribeChannel removes a websocket connection from the price board channel updates

func (*LendingPriceBoardSocket) UnsubscribeChannelHandler added in v1.2.0

func (s *LendingPriceBoardSocket) UnsubscribeChannelHandler(channelID string) func(c *Client)

UnsubscribeChannelHandler unsubscribes a connection from a certain lending price board channel id

func (*LendingPriceBoardSocket) UnsubscribeHandler added in v1.2.0

func (s *LendingPriceBoardSocket) UnsubscribeHandler() func(c *Client)

type LendingTradeSocket added in v1.2.0

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

LendingTradeSocket holds the map of connections subscribed to pair channels corresponding to the key/event they have subscribed to.

func GetLendingTradeSocket added in v1.2.0

func GetLendingTradeSocket() *LendingTradeSocket

GetLendingTradeSocket get current lending socket

func NewLendingTradeSocket added in v1.2.0

func NewLendingTradeSocket() *LendingTradeSocket

NewLendingTradeSocket init lending socket instance

func (*LendingTradeSocket) BroadcastMessage added in v1.2.0

func (s *LendingTradeSocket) BroadcastMessage(channelID string, p interface{})

BroadcastMessage broadcasts trade message to all subscribed sockets

func (*LendingTradeSocket) SendErrorMessage added in v1.2.0

func (s *LendingTradeSocket) SendErrorMessage(c *Client, p interface{})

SendErrorMessage sends an error message on the trade channel

func (*LendingTradeSocket) SendInitMessage added in v1.2.0

func (s *LendingTradeSocket) SendInitMessage(c *Client, p interface{})

SendInitMessage is responsible for sending message on trade ohlcv channel at subscription

func (*LendingTradeSocket) SendMessage added in v1.2.0

func (s *LendingTradeSocket) SendMessage(c *Client, msgType types.SubscriptionEvent, p interface{})

SendMessage sends a websocket message on the trade channel

func (*LendingTradeSocket) SendUpdateMessage added in v1.2.0

func (s *LendingTradeSocket) SendUpdateMessage(c *Client, p interface{})

SendUpdateMessage is responsible for sending message on trade ohlcv channel at subscription

func (*LendingTradeSocket) Subscribe added in v1.2.0

func (s *LendingTradeSocket) Subscribe(channelID string, c *Client) error

Subscribe registers a new websocket connections to the trade channel updates

func (*LendingTradeSocket) Unsubscribe added in v1.2.0

func (s *LendingTradeSocket) Unsubscribe(c *Client)

Unsubscribe removes a websocket connection from the trade channel updates

func (*LendingTradeSocket) UnsubscribeChannel added in v1.2.0

func (s *LendingTradeSocket) UnsubscribeChannel(channelID string, c *Client)

UnsubscribeChannel removes a websocket connection from the trade channel updates

func (*LendingTradeSocket) UnsubscribeChannelHandler added in v1.2.0

func (s *LendingTradeSocket) UnsubscribeChannelHandler(channelID string) func(c *Client)

UnsubscribeChannelHandler unsubscribes a connection from a certain trade channel id

func (*LendingTradeSocket) UnsubscribeHandler added in v1.2.0

func (s *LendingTradeSocket) UnsubscribeHandler() func(c *Client)

UnsubscribeHandler removes a websocket connection from the trade channel updates

type MarketsSocket

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

MarketsSocket holds the map of subscriptions subscribed to markets channels corresponding to the key/event they have subscribed to.

func GetMarketSocket

func GetMarketSocket() *MarketsSocket

GetMarketSocket return singleton instance of MarketsSocket type struct

func NewMarketsSocket

func NewMarketsSocket() *MarketsSocket

func (*MarketsSocket) BroadcastMessage

func (s *MarketsSocket) BroadcastMessage(channelID string, p interface{}) error

BroadcastMessage streams message to all the subscriptions subscribed to the pair

func (*MarketsSocket) SendErrorMessage

func (s *MarketsSocket) SendErrorMessage(c *Client, data interface{})

SendErrorMessage sends error message on markets channel

func (*MarketsSocket) SendInitMessage

func (s *MarketsSocket) SendInitMessage(c *Client, data interface{})

SendInitMessage sends INIT message on markets channel on subscription event

func (*MarketsSocket) SendMessage

func (s *MarketsSocket) SendMessage(c *Client, msgType types.SubscriptionEvent, p interface{})

SendMessage sends a websocket message on the markets channel

func (*MarketsSocket) SendUpdateMessage

func (s *MarketsSocket) SendUpdateMessage(c *Client, data interface{})

SendUpdateMessage sends UPDATE message on markets channel as new data is created

func (*MarketsSocket) Subscribe

func (s *MarketsSocket) Subscribe(channelID string, c *Client) error

Subscribe handles the subscription of connection to get streaming data over the socker for any pair.

func (*MarketsSocket) Unsubscribe

func (s *MarketsSocket) Unsubscribe(c *Client)

func (*MarketsSocket) UnsubscribeChannel

func (s *MarketsSocket) UnsubscribeChannel(channelID string, c *Client)

Unsubscribe removes a websocket connection from the markets channel updates

func (*MarketsSocket) UnsubscribeChannelHandler

func (s *MarketsSocket) UnsubscribeChannelHandler(channelID string) func(c *Client)

UnsubscribeHandler unsubscribes a connection from a certain markets channel id

func (*MarketsSocket) UnsubscribeHandler

func (s *MarketsSocket) UnsubscribeHandler() func(c *Client)

type NotificationConnection

type NotificationConnection []*Client

func GetNotificationConnections

func GetNotificationConnections(a common.Address) NotificationConnection

GetNotificationConnections returns the connection associated with an user address

type OHLCVSocket

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

OHLCVSocket holds the map of subscribtions subscribed to OHLCV channels corresponding to the key/event they have subscribed to.

func GetOHLCVSocket

func GetOHLCVSocket() *OHLCVSocket

GetOHLCVSocket return singleton instance of OHLCVSocket type struct

func NewOHLCVSocket

func NewOHLCVSocket() *OHLCVSocket

func (*OHLCVSocket) BroadcastOHLCV

func (s *OHLCVSocket) BroadcastOHLCV(channelID string, p interface{}) error

BroadcastOHLCV Message streams message to all the subscriptions subscribed to the pair

func (*OHLCVSocket) SendErrorMessage

func (s *OHLCVSocket) SendErrorMessage(c *Client, p interface{})

SendErrorMessage sends an error message on the trade channel

func (*OHLCVSocket) SendInitMessage

func (s *OHLCVSocket) SendInitMessage(c *Client, p interface{})

SendInitMessage is responsible for sending message on trade channel at subscription

func (*OHLCVSocket) SendMessage

func (s *OHLCVSocket) SendMessage(c *Client, msgType types.SubscriptionEvent, p interface{})

SendMessage sends a websocket message on the trade channel

func (*OHLCVSocket) SendUpdateMessage

func (s *OHLCVSocket) SendUpdateMessage(c *Client, p interface{})

SendUpdateMessage is responsible for sending message on trade channel at subscription

func (*OHLCVSocket) Subscribe

func (s *OHLCVSocket) Subscribe(channelID string, c *Client) error

Subscribe handles the registration of connection to get streaming data over the socket for any pair.

func (*OHLCVSocket) Unsubscribe

func (s *OHLCVSocket) Unsubscribe(c *Client)

func (*OHLCVSocket) UnsubscribeChannel

func (s *OHLCVSocket) UnsubscribeChannel(channelID string, c *Client)

Unsubscribe is used to unsubscribe the connection from listening to the key subscribed to. It can be called on unsubscription message from user or due to some other reason by system

func (*OHLCVSocket) UnsubscribeChannelHandler

func (s *OHLCVSocket) UnsubscribeChannelHandler(channelID string) func(c *Client)

UnsubscribeHandler returns function of type unsubscribe handler, it handles the unsubscription of pair in case of connection closing.

func (*OHLCVSocket) UnsubscribeHandler

func (s *OHLCVSocket) UnsubscribeHandler() func(c *Client)

type OrderBookSocket

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

OrderBookSocket holds the map of subscriptions subscribed to orderbook channels corresponding to the key/event they have subscribed to.

func GetOrderBookSocket

func GetOrderBookSocket() *OrderBookSocket

GetOrderBookSocket return singleton instance of OrderBookSocket type struct

func NewOrderBookSocket

func NewOrderBookSocket() *OrderBookSocket

func (*OrderBookSocket) BroadcastMessage

func (s *OrderBookSocket) BroadcastMessage(channelID string, p interface{}) error

BroadcastMessage streams message to all the subscribtions subscribed to the pair

func (*OrderBookSocket) SendErrorMessage

func (s *OrderBookSocket) SendErrorMessage(c *Client, data interface{})

SendErrorMessage sends error message on orderbook channel

func (*OrderBookSocket) SendInitMessage

func (s *OrderBookSocket) SendInitMessage(c *Client, data interface{})

SendInitMessage sends INIT message on orderbook channel on subscription event

func (*OrderBookSocket) SendMessage

func (s *OrderBookSocket) SendMessage(c *Client, msgType types.SubscriptionEvent, p interface{})

SendMessage sends a websocket message on the orderbook channel

func (*OrderBookSocket) SendUpdateMessage

func (s *OrderBookSocket) SendUpdateMessage(c *Client, data interface{})

SendUpdateMessage sends UPDATE message on orderbook channel as new data is created

func (*OrderBookSocket) Subscribe

func (s *OrderBookSocket) Subscribe(channelID string, c *Client) error

Subscribe handles the subscription of connection to get streaming data over the socker for any pair. pair := utils.GetPairKey(bt, qt)

func (*OrderBookSocket) Unsubscribe

func (s *OrderBookSocket) Unsubscribe(c *Client)

func (*OrderBookSocket) UnsubscribeChannel

func (s *OrderBookSocket) UnsubscribeChannel(channelID string, c *Client)

UnsubscribeChannel removes a websocket connection from the orderbook channel updates

func (*OrderBookSocket) UnsubscribeChannelHandler

func (s *OrderBookSocket) UnsubscribeChannelHandler(channelID string) func(c *Client)

UnsubscribeHandler unsubscribes a connection from a certain orderbook channel id

func (*OrderBookSocket) UnsubscribeHandler

func (s *OrderBookSocket) UnsubscribeHandler() func(c *Client)

type OrderConnection

type OrderConnection []*Client

func GetOrderConnections

func GetOrderConnections(a common.Address) OrderConnection

GetOrderConn returns the connection associated with an order ID

type PriceBoardSocket

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

PriceBoardSocket holds the map of subscriptions subscribed to price board channels corresponding to the key/event they have subscribed to.

func GetPriceBoardSocket

func GetPriceBoardSocket() *PriceBoardSocket

GetPriceBoardSocket return singleton instance of PriceBoardSocket type struct

func NewPriceBoardSocket

func NewPriceBoardSocket() *PriceBoardSocket

func (*PriceBoardSocket) BroadcastMessage

func (s *PriceBoardSocket) BroadcastMessage(channelID string, p interface{}) error

BroadcastMessage streams message to all the subscriptions subscribed to the pair

func (*PriceBoardSocket) SendErrorMessage

func (s *PriceBoardSocket) SendErrorMessage(c *Client, data interface{})

SendErrorMessage sends error message on price board channel

func (*PriceBoardSocket) SendInitMessage

func (s *PriceBoardSocket) SendInitMessage(c *Client, data interface{})

SendInitMessage sends INIT message on price board channel on subscription event

func (*PriceBoardSocket) SendMessage

func (s *PriceBoardSocket) SendMessage(c *Client, msgType types.SubscriptionEvent, p interface{})

SendMessage sends a websocket message on the price board channel

func (*PriceBoardSocket) SendUpdateMessage

func (s *PriceBoardSocket) SendUpdateMessage(c *Client, data interface{})

SendUpdateMessage sends UPDATE message on price board channel as new data is created

func (*PriceBoardSocket) Subscribe

func (s *PriceBoardSocket) Subscribe(channelID string, c *Client) error

Subscribe handles the subscription of connection to get streaming data over the socker for any pair.

func (*PriceBoardSocket) Unsubscribe

func (s *PriceBoardSocket) Unsubscribe(c *Client)

func (*PriceBoardSocket) UnsubscribeChannel

func (s *PriceBoardSocket) UnsubscribeChannel(channelID string, c *Client)

UnsubscribeChannel removes a websocket connection from the price board channel updates

func (*PriceBoardSocket) UnsubscribeChannelHandler

func (s *PriceBoardSocket) UnsubscribeChannelHandler(channelID string) func(c *Client)

UnsubscribeHandler unsubscribes a connection from a certain price board channel id

func (*PriceBoardSocket) UnsubscribeHandler

func (s *PriceBoardSocket) UnsubscribeHandler() func(c *Client)

type RawOrderBookSocket

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

RawOrderBookSocket holds the map of subscribtions subscribed to pair channels corresponding to the key/event they have subscribed to.

func GetRawOrderBookSocket

func GetRawOrderBookSocket() *RawOrderBookSocket

GetRawOrderBookSocket return singleton instance of PairSockets type struct

func NewRawOrderBookSocket

func NewRawOrderBookSocket() *RawOrderBookSocket

func (*RawOrderBookSocket) BroadcastMessage

func (s *RawOrderBookSocket) BroadcastMessage(channelID string, p interface{}) error

BroadcastMessage streams message to all the subscribtions subscribed to the pair

func (*RawOrderBookSocket) SendErrorMessage

func (s *RawOrderBookSocket) SendErrorMessage(c *Client, data interface{})

func (*RawOrderBookSocket) SendInitMessage

func (s *RawOrderBookSocket) SendInitMessage(c *Client, data interface{})

SendInitMessage sends INIT message on orderbookchannel on subscription event

func (*RawOrderBookSocket) SendUpdateMessage

func (s *RawOrderBookSocket) SendUpdateMessage(c *Client, data interface{})

SendUpdateMessage sends UPDATE message on orderbookchannel as new data is created

func (*RawOrderBookSocket) Subscribe

func (s *RawOrderBookSocket) Subscribe(channelID string, c *Client) error

Subscribe handles the subscription of connection to get streaming data over the socker for any pair. pair := utils.GetPairKey(bt, qt)

func (*RawOrderBookSocket) Unsubscribe

func (s *RawOrderBookSocket) Unsubscribe(c *Client)

func (*RawOrderBookSocket) UnsubscribeChannel

func (s *RawOrderBookSocket) UnsubscribeChannel(channelID string, c *Client)

Unsubscribe is used to unsubscribe the connection from listening to the key subscribed to. It can be called on unsubscription message from user or due to some other reason by system

func (*RawOrderBookSocket) UnsubscribeChannelHandler

func (s *RawOrderBookSocket) UnsubscribeChannelHandler(channelID string) func(c *Client)

UnsubscribeHandler returns function of type unsubscribe handler, it handles the unsubscription of pair in case of connection closing.

func (*RawOrderBookSocket) UnsubscribeHandler

func (s *RawOrderBookSocket) UnsubscribeHandler() func(c *Client)

type TradeSocket

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

TradeSocket holds the map of connections subscribed to pair channels corresponding to the key/event they have subscribed to.

func GetTradeSocket

func GetTradeSocket() *TradeSocket

func NewTradeSocket

func NewTradeSocket() *TradeSocket

func (*TradeSocket) BroadcastMessage

func (s *TradeSocket) BroadcastMessage(channelID string, p interface{})

BroadcastMessage broadcasts trade message to all subscribed sockets

func (*TradeSocket) SendErrorMessage

func (s *TradeSocket) SendErrorMessage(c *Client, p interface{})

SendErrorMessage sends an error message on the trade channel

func (*TradeSocket) SendInitMessage

func (s *TradeSocket) SendInitMessage(c *Client, p interface{})

SendInitMessage is responsible for sending message on trade ohlcv channel at subscription

func (*TradeSocket) SendMessage

func (s *TradeSocket) SendMessage(c *Client, msgType types.SubscriptionEvent, p interface{})

SendMessage sends a websocket message on the trade channel

func (*TradeSocket) SendUpdateMessage

func (s *TradeSocket) SendUpdateMessage(c *Client, p interface{})

SendUpdateMessage is responsible for sending message on trade ohlcv channel at subscription

func (*TradeSocket) Subscribe

func (s *TradeSocket) Subscribe(channelID string, c *Client) error

Subscribe registers a new websocket connections to the trade channel updates

func (*TradeSocket) Unsubscribe

func (s *TradeSocket) Unsubscribe(c *Client)

func (*TradeSocket) UnsubscribeChannel

func (s *TradeSocket) UnsubscribeChannel(channelID string, c *Client)

UnsubscribeChannel removes a websocket connection from the trade channel updates

func (*TradeSocket) UnsubscribeChannelHandler

func (s *TradeSocket) UnsubscribeChannelHandler(channelID string) func(c *Client)

UnsubscribeChannelHandler unsubscribes a connection from a certain trade channel id

func (*TradeSocket) UnsubscribeHandler

func (s *TradeSocket) UnsubscribeHandler() func(c *Client)

type WebsocketLogger

type WebsocketLogger struct {
	*logging.Logger
	// contains filtered or unexported fields
}

func NewWebsocketLogger

func NewWebsocketLogger() *WebsocketLogger

func (*WebsocketLogger) LogMessageIn

func (l *WebsocketLogger) LogMessageIn(msg *types.WebsocketMessage)

func (*WebsocketLogger) LogMessageOut

func (l *WebsocketLogger) LogMessageOut(msg *types.WebsocketMessage)

Jump to

Keyboard shortcuts

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