adding heartbeat option to url
use `emitErr` for connection errors so we don't swallow them if no callback is given