Implement `stateChange` event

This commit implements the `stateChange` event, which is emitted by `server/ServerManager`.