move message code to simplechat-library