Search code examples
haskellstreaminghaskell-snap-framework

How to delay the outcoming data stream in Snap


I can send GET requests via a WiFi shield (ESP8266) on an Arduino Mega and I have a Snap-Webserver running, that serves a static directory with large .txt-Files (~ 1 MB).

Unfortunately, I can't parse the incoming data with an Arduino as fast as it gets send. I lose around ~ 50% of the incoming data.

Is there a possibility to configure Snap that it would delay the outcoming stream of data? It would be perfect if I could tell Snap to wait ~ 10 ms after a delimiter in the .txt-file ('\n' for example).


Solution

  • I would insert a proxy server to throttle the data.

    Here is a simple proxy written in 100 lines of Python which would be easy to modify to add output delays:

    http://voorloopnul.com/blog/a-python-proxy-in-less-than-100-lines-of-code/