diff --git a/client/client.go b/client/client.go index e3110be..512e678 100644 --- a/client/client.go +++ b/client/client.go @@ -202,11 +202,12 @@ func (c *Client) handleClient(readChan <-chan css.SocketMessage, writeChan chan< func (c *Client) handleSend(stopChan <-chan struct{}, doneChan chan<- error, writeChan chan<- css.SocketMessage) { var ( - rs *requestState - id interface{} - message []byte - err error - ok bool + rs *requestState + id interface{} + messageType int + message []byte + err error + ok bool ) defer func() { @@ -233,7 +234,7 @@ LOOP: if 0 < rs.id { id = rs.id } - message, err = c.ClientHandler.GetRPCCodec().NewRequest(rs.method, rs.params, id) + messageType, message, err = c.ClientHandler.GetRPCCodec().NewRequest(rs.method, rs.params, id) if nil != err { rs.setError(err) rs.done() @@ -241,7 +242,7 @@ LOOP: } select { - case writeChan <- css.MakeSocketMessage(css.TextMessage, message): + case writeChan <- css.MakeSocketMessage(messageType, message): default: rs.setError(fmt.Errorf("%s cannot send request", c.logHeader())) rs.done()