An elegant way to define lightweight protocols on-top of TCP/TLS sockets in node.js