Sorry for the noise, I found the code ("develop" branch of https://github.com/leivaburto/rwsd) and add a couple more comments:
1. The "WEBSOCKETS" global seems like it wants to be a class instead: you've basically got a bunch of static functions (add_websocket, etc) that manipulate a global variable (WEBSOCKETS) which will be hard to mock, etc. Making this its own class that encapsulates the websockets and contains methods ("init_websockets" becomes the constructor, ".add_websocket()" becomes a ".add" method etc) will make it easier to mock and use. IMO. So, e.g., instead of calling init_websockets() in run_server, you'd instantiate a new WebSocketTracker() or whatever and pass it to your Application where your handlers can then get at it.
2. I didn't look at any threading very closely, but in general if you're interacting with a threaded/syncrhonous library like Stem you're going to want to do that via deferToThread()/callFromThread() and so forth to avoid blocking the reactor for "too long" and to avoid calling reactor methods from any thread that isn't the main one. Practically speaking, with a 1:1 relay-to-local-Tor/Stem instance this might not really matter very much (i.e. if there's always 0 or 1 web browser clients it probably doesn't matter how long you pause the reactor).
Cheers, meejah