Please note it has been a while since I wrote this implementation, but it appears nobody ever documented this properly. So this is to give people some directions on where to look. Feel free to update and add to this document.
The Node.js module allows one to extend the behavior of the server. This way we can emit and handle custom event handlers.