Sending messages to server and back