server

package
v0.0.0-...-df03107 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2020 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ParamError = errcode.CreateCoinBaseError(
		paramErrorCode, "request param error:%s")
	ReqError = errcode.CreateCoinBaseError(requestErrorCode, "%s")
)

Functions

func Check

func Check(r *http.Request) bool

func Response

func Response(ctx *gin.Context, httpCode int, dataMap interface{})

func ResponseError

func ResponseError(
	ctx *gin.Context, httpCode int,
	err *errcode.CoinBaseError, model interface{})

Types

type Client

type Client struct {
	ID      string
	Socket  *websocket.Conn
	Receive chan *Message
	Send    chan *api.MsgData
	SendMsg chan []byte
	// contains filtered or unexported fields
}

func NewClient

func NewClient(
	conn *websocket.Conn) *Client

func (*Client) Read

func (c *Client) Read()

func (*Client) String

func (c *Client) String() string

func (*Client) UpdateExchange

func (c *Client) UpdateExchange(op int, exchange string)

func (*Client) UpdateMsgType

func (c *Client) UpdateMsgType(op int, typ int)

func (*Client) UpdateSymbol

func (c *Client) UpdateSymbol(op int, symbol string)

func (*Client) Write

func (c *Client) Write()

type ClientManager

type ClientManager struct {
	Broadcast  chan *api.MsgData
	PartialMsg chan string
	// contains filtered or unexported fields
}

func NewClientManager

func NewClientManager(ctx context.Context) *ClientManager

func (*ClientManager) Start

func (manager *ClientManager) Start()

func (*ClientManager) Stop

func (manager *ClientManager) Stop()

type CoinCorpServer

type CoinCorpServer struct {
	Upgrader      *websocket.Upgrader
	ClientManager *ClientManager
	// contains filtered or unexported fields
}

func CreateCoinCorpServer

func CreateCoinCorpServer(
	ctx context.Context, cfg *baseconfig.HTTPConfig,
	msgManagerMap map[string]*msgmanager.MessageManager,
	exchanges map[string]api.ExchangeAPI) *CoinCorpServer

func (*CoinCorpServer) ApiHandler

func (server *CoinCorpServer) ApiHandler(ctx *gin.Context)

func (*CoinCorpServer) EditLeverage

func (server *CoinCorpServer) EditLeverage(ctx *gin.Context)

func (*CoinCorpServer) Shutdown

func (server *CoinCorpServer) Shutdown()

func (*CoinCorpServer) Start

func (server *CoinCorpServer) Start()

func (*CoinCorpServer) Stop

func (server *CoinCorpServer) Stop()

func (*CoinCorpServer) TradeOrder

func (server *CoinCorpServer) TradeOrder(ctx *gin.Context)

type LeverageModel

type LeverageModel struct {
	Exchange string  `form:"exchange" json:"exchange" binding:"required"`
	Symbol   string  `form:"symbol" json:"symbol" binding:"required"`
	Leverage float64 `form:"leverage" json:"leverage" binding:"required"`
}

type Message

type Message struct {
	Sender    string `json:"sender,omitempty"`
	Recipient string `json:"recipient,omitempty"`
	Content   []byte `json:"content,omitempty"`
}

Jump to

Keyboard shortcuts

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