Sending messages to server after key pressed