(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
If I understand it correctly, one of the nice features in C++11 is that closing the stack frame on this function will automatically unlock this mutex?