Setting up message exchange between server and client