-
Notifications
You must be signed in to change notification settings - Fork 20
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
Make it possible to use multiple websockets and callbacks #40
Conversation
This will be more efficient in general if the callback dictionary is keyed as |
dae6104
to
c351db6
Compare
I changed the ordering in the tuple to optimize comparisons in the @markhamburg, were you able to try the code out on your example? |
* This makes it possible to use the library with more than one endpoint that has the same Channel.on* callback * Extra whitespace is due to elm-format
c351db6
to
9a185c3
Compare
This looks really good @edennis! I think this is ready to get merged if @markhamburg can verify that this resolves his problem. |
@saschatimme I'll see if I can put together a simple example app that will show the "before" and "after" behavior. |
@saschatimme I've pushed a small example app that demonstrates the broken behavior in the current version. If you run it as is you'll see the error I've described in the README. It's a bit of a pain to test my PR since you'll have to clone it locally. What I did was more or less:
and then recompile and run again. Hope this helps convince you. |
awesome work @edennis! :) |
Do you have other changes planned or shall I cut an release? |
@saschatimme Thanks! I haven't actually popped everything from the stack yet - there is one more coming, but I can't make any promises about ETA. I'd probably go ahead with a version bump now for the sake of granularity just in case anyone reports regressions. |
I pulled the code into my project and tried to recreate the situation we had before and it all worked correctly this time. The diff against my own patches also confirmed that this was doing what I expected. |
As described in #33 the internal state of the effects manager wasn't equipped to handle callbacks for multiple websockets. Using a tuple of the
Endpoint
andRef
now makes that possible.I also had to fix the broken documentation in
Phoenix.Presence
to makeelm-make
stop complaining. The extra whitespace in the diff is due toelm-format
.