gdax.netcore
gdax.netcore copied to clipboard
ClientWebSocket truncates large messages.
I implemented Snapshot message for realtime client and it is quite large (I guess around 100K) but EndOfMessage becomes true around 60-80K hence I get always a part of it. and there is no way around.
Any help will be appreciated
@maxima120 Do you have any code I can test with, or a stack trace? I'm not aware of any size limitations at the web socket level, so a bit more info would be handy to troubleshoot.
Easy way to see the issue is to modify the requestString to give level2 data like this:
var requestString = JsonConvert.SerializeObject(new {
type = "subscribe",
product_ids = ProductIds,
channels = new string[] { "level2" }
});
Level2 data starts with a big snapshot dump of the order book. Data is eventually jumbled.
Fix for this is:
await stream.WriteAsync(receiveBuffer.Array, receiveBuffer.Offset, webSocketReceiveResult.Count);
The change is to use the webSocketReicveResult.Count instead.