My main concern with the program in its current state is the lack of sufficient design. I mean, both the Configuration and MessageRouter objects are glorified dictionaries (or defaultdicts), and global variables are used for the router and config.
Also, the config protocol is almost definitely a bad idea. Since it's unauthenticated, the only way to guarantee security is to use a Unix socket (or some other only-locally-accessible method), at which point you already have the means of stopping the server and reading the config. Finally, stats should be fine if publicly available. In other words, the only useful thing the control protocol could be used for is reloading the configuration.
Other than that, minor quirks, such as handleJSONCommand, a protocol function, being put in the Subscriber class.
And, of course, there's the issue of performance. Python doesn't handle threads, and since Twisted isn't multiprocess AFAIK, this might not be able to handle that many connections.
Finally, other than WebSocket and the socket interface, the one other subscription method we should have it some sort of HTTP hook call, i.e., it sends an HTTP request to the subscriber. This allows event-driven clients without having a socket constantly open.
*--* *Tyler Romeo* Stevens Institute of Technology, Class of 2015 Major in Computer Science www.whizkidztech.com | tylerromeo@gmail.com