Improve stream building and functions

- Get rid of the ugly BY() macro.
- Make rate work again
Make websockets more robust

Make sure that expensive websocket queries don't hurt perforamnce and
stability of the other parts of the system.

Make websocket buffers smaller: favor stability and bounded queues
over never dropping a websocket event.

(Fixes #47)