Is it possible to be notified when a client is connected / disconnected

Currently our clients publish so-called heartbeat messages so the other clients in the exchange know that they are online. Is it possible for the broker itself to publish on a designated topic when a client connects and disconnects?