xchg-rax-rax / crypto_quote_service

A program for obtaining mass market data from from various crypto excahnges for the purpose back-testing and training ML models
0 stars 0 forks source link

Add write Queue to the websocket #13

Open xchg-rax-rax opened 1 year ago

xchg-rax-rax commented 1 year ago

Overview

It has come to my attention that th boost websocket makes no guarantees about the order in which it sends messages dispatched using async_write. As a result in order to guarantee that the server receives messages in the order that we dispatch them we should introduce a write queue onto which messages are pushed and from which they are drawn.

Implementation

For the queue a std:: dqeue is likely the best option. Write should be modified to call this and we should implement an on_write method to read from the queue until it is empty.