func (c *Client) handleMessages() {
	go func() {
		for {
			select {
			case request := <-c.requests:
				// log.Printf("Request is equal to %v", request)
				c.requestLogs = append(c.requestLogs, request)
				switch request.MessageType {
				case PLACE_ORDER:
					go c.placeOrder(request)
				case SIGNED_DATA:
					go c.sendSignedData(request)
				case CANCEL_ORDER:
					go c.cancelOrder(request)
				case DONE:
					go c.done()
				}
			case response := <-c.responses:
				c.responseLogs = append(c.responseLogs, response)
				switch response.MessageType {
				case ORDER_PLACED:
					go c.handleOrderPlaced(response.Payload)
				case ORDER_CANCELED:
					go c.handleOrderCanceled(response.Payload)
				case REQUEST_SIGNED_DATA:
					go c.handleRequestSignedData(response.Payload)
				case ORDER_FILLED:
					go c.handleOrderFilled(response.Payload)
				case ORDER_EXECUTED:
					go c.handleOrderExecuted(response.Payload)
				case ORDER_TX_SUCCESS:
					go c.handleOrderTxSuccess(response.Payload)
				case ORDER_TX_ERROR:
					go c.handleOrderTxError(response.Payload)
				case TRADE_EXECUTED:
					go c.handleTradeExecuted(response.Payload)
				case TRADE_TX_SUCCESS:
					go c.handleTradeTxSuccess(response.Payload)
				case TRADE_TX_ERROR:
					go c.handleTradeTxError(response.Payload)
				}
			}
		}
	}()
}
// handleMessages waits for incoming messages and routes messages to the
// corresponding handler.
// requests are the messages that are written on the client and destined to
// the server. responses are the message that are
handleMessages waits for incoming messages and routes messages to the
corresponding handler.
requests are the messages that are written on the client and destined to
the server. responses are the message that are
// handleMessages waits for incoming messages and routes messages to the // corresponding handler . // requests are the messages that are written on the client and destined to // the server . responses are the message that are
func (c *Client) handleMessages() {
	go func() {
		for {
			select {
			case request := <-c.requests:
				c.requestLogs = append(c.requestLogs, request)
				switch request.MessageType {
				case PLACE_ORDER:
					go c.placeOrder(request)
				case SIGNED_DATA:
					go c.sendSignedData(request)
				case CANCEL_ORDER:
					go c.cancelOrder(request)
				case DONE:
					go c.done()
				}
			case response := <-c.responses:
				c.responseLogs = append(c.responseLogs, response)
				switch response.MessageType {
				case ORDER_PLACED:
					go c.handleOrderPlaced(response.Payload)
				case ORDER_CANCELED:
					go c.handleOrderCanceled(response.Payload)
				case REQUEST_SIGNED_DATA:
					go c.handleRequestSignedData(response.Payload)
				case ORDER_FILLED:
					go c.handleOrderFilled(response.Payload)
				case ORDER_EXECUTED:
					go c.handleOrderExecuted(response.Payload)
				case ORDER_TX_SUCCESS:
					go c.handleOrderTxSuccess(response.Payload)
				case ORDER_TX_ERROR:
					go c.handleOrderTxError(response.Payload)
				case TRADE_EXECUTED:
					go c.handleTradeExecuted(response.Payload)
				case TRADE_TX_SUCCESS:
					go c.handleTradeTxSuccess(response.Payload)
				case TRADE_TX_ERROR:
					go c.handleTradeTxError(response.Payload)
				}
			}
		}
	}()
}
func ( c * Client ) handleMessages ( ) { go func ( ) { for { select { case request := <- c . requests : c . requestLogs = append ( c . requestLogs , request ) switch request . MessageType { case PLACE_ORDER : go c . placeOrder ( request ) case SIGNED_DATA : go c . sendSignedData ( request ) case CANCEL_ORDER : go c . cancelOrder ( request ) case DONE : go c . done ( ) } case response := <- c . responses : c . responseLogs = append ( c . responseLogs , response ) switch response . MessageType { case ORDER_PLACED : go c . handleOrderPlaced ( response . Payload ) case ORDER_CANCELED : go c . handleOrderCanceled ( response . Payload ) case REQUEST_SIGNED_DATA : go c . handleRequestSignedData ( response . Payload ) case ORDER_FILLED : go c . handleOrderFilled ( response . Payload ) case ORDER_EXECUTED : go c . handleOrderExecuted ( response . Payload ) case ORDER_TX_SUCCESS : go c . handleOrderTxSuccess ( response . Payload ) case ORDER_TX_ERROR : go c . handleOrderTxError ( response . Payload ) case TRADE_EXECUTED : go c . handleTradeExecuted ( response . Payload ) case TRADE_TX_SUCCESS : go c . handleTradeTxSuccess ( response . Payload ) case TRADE_TX_ERROR : go c . handleTradeTxError ( response . Payload ) } } } } ( ) }
handleMessages waits for incoming messages and routes messages to the
corresponding handler.
handleMessages waits for incoming messages and routes messages to the corresponding handler .
// log.Printf("Request is equal to %v", request)