(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
Perhaps not the subject of this PR, but definitely worth spending time on. Dealing with random segmentation faults or other magic behavior because these things are not covered well are the worst bugs I've ever come across (in terms of time consumed trying to reproduce (virtually impossible) and debug them).