Implement unregister_notification

Fairly trivial change which essentially reverses a register_notification call.
Also removes the mapping if the client seeking removal is the last one in the list, so we don't waste time testing notifications to send on an empty list.