Fix race condition, where messages were sent to the client before they were initiated.
Now an event is emitted when they are ready, fixes #19