-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Potential enhancements? #2
Comments
Forgot to mention: As the |
Hi @ngscheurich! These changes would be welcome, feel free to submit a PR(I'd be happy to provide context if you're not familiar with Spark, the library this is built with), or I can do that when I get some time Specifically, I think we need the following additions:
I was also playing with the idea of having something like LiveView's |
Sounds great, @doorgan. Thanks for the pointers. I'll submit a PR and we can go from there! |
@doorgan I've done a bit of work on this but am unsure how to proceed. I'm stuck on getting Spark to allow pattern matching on a @info %Spark.Dsl.Entity{
name: :info,
target: Info,
args: [:message, :module, {:optional, :function, :handle_info}],
schema: [
message: [type: :any, required: true],
module: [type: :atom, required: true],
function: [type: :atom, required: true]
],
modules: [:module]
} I can use it in a router like this: info {:info, :delegate}, ChannelHandler.RouterTest.TestHandler The problem crops up, however, if I use try to pattern-match the info {:info, _}, ChannelHandler.RouterTest.TestHandler I'm reading over the Spark source but thought you might have some insight in the meantime. |
@ngscheurich Ah! You need to set the So the idea is that you use that pattern to generate a |
Ah, great! Thanks for the pointer, @doorgan. |
Hi! My team is using a Channel module paradigm that lends itself nicely to ChannelHandler's capabilities, so I was excited to come across this project. In addition to dispatching
handle_events
s, we also dispatchjoin
s andhandle_info
s, which ends up looking something like this:What do y'all think about adding macros to ChannelHandler for
join
andhandle_info
such that something like the following would be possible?This would really help us streamline our Channel modules into pure "routers" and I imagine could be useful for other ChannelHandler users. I'm happy to do the work on this feature but would like to gauge the likelihood of something like it getting merged.
While evaluating our options, I prototyped a simple set of macros that do what we need and may be of further use in demonstrating the use case: Dispatcher. Check
LobbyChannel
andRoomChannel
for example usage.My implementation doesn't include things like scopes and plugs, which I think are awesome features. Furthermore, I'd rather contribute to an existing community effort than create another library.
Happy to chat more, and looking forward to hearing your thoughts.
The text was updated successfully, but these errors were encountered: