cgmartin/clj-wamp

Allow dynamically defining RPC endpoints and event channels.

Opened this issue · 2 comments

Great library though there's areas where I would like some increased flexibility. It doesn't appear that RPC endpoints or event channels can be dynamically added. Is there anyway this functionality could be added? If there's already a way to do this could you indicate how this could be accomplished?

Hi, @jasongilman . The RPC and event channel map can't currently be modified dynamically, though that would be a great feature to add.

There's sort of a workaround by specifying all RPC/channels up front, but restricting them within an on-publish-fn event broker or within the RPC function itself (or on-before-call-fn). The CRA auth permissions feature could also be used to allow/deny access through the auth-permissions-fn which gets called on each message. (See http://cljwamp.us/doc/clj-wamp.server.html#var-http-kit-handler for some additional info)

Depending on your situation, these workarounds might not be possible (don't know all possibilities up front) or not as convenient as dynamic adds/removes. Going to add this as something to look into for a 1.2.0 release. Thanks!

I kinda worked around this by hooking up handlers to different routes (as in different WS_URI's) which seems to work for my purposes (I have a broker to which workers can dynamically connect, so the availability of the WAMP RPC depends on the available works, which is determined runtime).

The downside is of course that it's not the way WAMP is supposed to work ;-)