Yup, an official "presence" feature is already feature complete and in test. However you can already mimic its functionality via listening as shown in this tutorial at this line of code.
Generally speaking, all clients would subscribe to a status event specific to them, e.g.
ds.event.subscribe( 'status/' + name );
The server would now listen for subscriptions for these events and deduce the online status:
ds.event.listen( 'status/.*', this._playerOnlineStatusChanged.bind( this ) );
_playerOnlineStatusChanged( match, isSubscribed ) {
// Extract the player name from the status event
var name = match.replace( 'status/', '' );
if( isSubscribed ) {
this.addPlayer( name );
} else {
this.removePlayer( name );
}
}
This will keep track of any disconnect, whether intentional or accidental