added a reading loop in handle_fdevent to read all data from server
(until 100ms timeout) before transmitting on the web socket. This to fix
the issue where the server had to call write() several times to send the
whole message, and the web client at the other end was receiving each
fragment separately.