Only ensure socket keep alive if socket exists

This is irrelevant if you're connecting via WebSockets, and causes an
error.
Emit data from new connection to the callback.

This allows the callback function to get access to the JID data.