gdax.netcore icon indicating copy to clipboard operation
gdax.netcore copied to clipboard

ClientWebSocket truncates large messages.

Open maxima120 opened this issue 7 years ago • 3 comments

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 avatar Nov 02 '17 21:11 maxima120

@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.

sefbkn avatar Nov 20 '17 04:11 sefbkn

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.

nsxdavid avatar Nov 26 '17 18:11 nsxdavid

Fix for this is:

await stream.WriteAsync(receiveBuffer.Array, receiveBuffer.Offset, webSocketReceiveResult.Count);

The change is to use the webSocketReicveResult.Count instead.

nsxdavid avatar Nov 26 '17 18:11 nsxdavid