Adapt the send message functionality to send only JSON Messages to the client
Fix a Bug which causes an error if the client lost the connection and tried to reconnect to the server