Update Message structure: change Payload type to bytes and add Encoding field
This commit is contained in:
@@ -1,6 +1,14 @@
|
||||
package domain
|
||||
|
||||
type Encoding string
|
||||
|
||||
const (
|
||||
EncodingJSON Encoding = "json"
|
||||
EncodingProtobuf Encoding = "protobuf"
|
||||
)
|
||||
|
||||
type Message struct {
|
||||
Identifier Identifier
|
||||
Payload any
|
||||
Payload []byte
|
||||
Encoding Encoding
|
||||
}
|
||||
|
||||
@@ -141,7 +141,8 @@ func (b *FuturesWebsocket) readLoop() {
|
||||
Provider: "binance_futures_websocket",
|
||||
Subject: container.Stream,
|
||||
},
|
||||
Payload: container.Data,
|
||||
Payload: []byte(container.Data),
|
||||
Encoding: domain.EncodingJSON,
|
||||
}
|
||||
|
||||
select {
|
||||
|
||||
@@ -45,7 +45,8 @@ func (s *GRPCStreamingServer) ConnectStream(req *pb.ConnectStreamRequest, stream
|
||||
Provider: msg.Identifier.Provider,
|
||||
Subject: msg.Identifier.Subject,
|
||||
},
|
||||
Payload: fmt.Sprintf("%v", msg.Payload),
|
||||
Payload: msg.Payload,
|
||||
Encoding: string(msg.Encoding),
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user