added utf8 support, limit messages length to prevent unexpected disconnects