The --token-plugin/--token-source mechanism is actually fairly dynamic and allows easy integration with external tools without having to modify or extend websockify. In particular, you can use that mechanism with a directory of files that each contain a single mapping and update these files dynamically (websockify reads the file/directory mappings every time a new connection is made).
For example:
./run --web ../novnc --token-plugin=TokenFile --token-source=`pwd`/target.cfg.d 6080
Inside target.cfg.d/ is one file t1 containing:
# My first target
target1: host1:5900
If noVNC connects and passes: "?token=target1" as the websocket connection path, then websockify will attempt to connect to host1:5900 as the target.
While websockify is running, you can add a new file t2 to that directory containing:
target2: host2:5901
As soon as you add that file, new connections with token "target2" will cause websockify to connect to host2:5901. Also important to note is that if you delete t1, new connections with token "target1" will be denied.
This setup allows external tools to easy modify the connection files and update them on the fly without restarting websockify.
Also, if websockify is not run in a fully trusted environment (and maybe even if it is), I suggest using short lived random UUIDs for the connection tokens. Note that already existing VNC connection will not be dropped if the token file goes away after connecting. This enables a secured web framework to generate a temporary UUID for a token, create the connection file, forward the cilent to the correct URL including the token and then delete it after 30 seconds.
Anyways, hope that helps,
Joel Martin (kanaka)