process messages on the event loop