Added a keep-alive

Fix for a bug where the socket isn't kept alive and just dies.