There's websocketd, which makes your program just a matter of reading from stdin and writing stdout. http://websocketd.com/