Closed boydm closed 6 years ago
Thanks for contributing back!
This looks good, and I'm basically in favour of merging this feature, but I'd like to discuss one thing about the interface first.
What is the reason for choosing this particular return type? Since the topic status is binary (joined/not joined), we could return a boolean, and of course rename the function to e.g. joined?
. At first glance, that seems a bit more idiomatic to me. What do you think?
Yes. Good point.
The signature should be joined?/1 and return a boolean.
I'll update the pull request later today after I'm done driving the kids around...
Thanks!
While you're at it, could you also capitalize the first letter in the function doc? I believe this is the only other remark I have :-)
Right. Changed the name of the function and fixed the capitalization.
Thanks!
I made a couple of minor changes, and merged.
Thank you very much!
Your changes area also a good example of keeping internal knowledge internal. Makes sense.
--Boyd
I had a need to query the status of a topic, without actually sending a ping to the server. Querying the process dictionary to get the value of the
join_ref
in my socket module would work, but means leaking "private" knowledge ofphoenix_gen_socket_client
internals into the callback module.So I added a very simple
GenSocketClient.topic_status/1
function, which queries thejoin_ref
and returns either:joined
or:not_joined
.This allows me to check the status of a topic, while keeping the knowledge of how to query the process dictionary in the
phoenix_gen_socket_client
where it belongs.Also added tests.