(WIP) Events

Todo:
- [x] Read events from the user command response
- [x] Read events from the message stream
- [x] Make a loop to do longpolling/shortpolling
- [x] Replace std:cerr by exceptions
- [x] mutex
There's an up to 5 seconds (could be much worse) wait here. I think that can be avoided (see above).