Skip to content

Complex topics trigger a Protocol.UndefinedError#1

Open
stmichael wants to merge 1 commit intokbremner:masterfrom
stmichael:fix-complex-topics
Open

Complex topics trigger a Protocol.UndefinedError#1
stmichael wants to merge 1 commit intokbremner:masterfrom
stmichael:fix-complex-topics

Conversation

@stmichael
Copy link

Thanks for this small but useful library. I write something very similar of my own and thought about publishing it. But then I stumbled upon your project which completely satisfies my needs.

I came across an issue. I need to have more complex topics than just plain string. Unfortunately that produced an error:

[error] an exception was raised:
    ** (Protocol.UndefinedError) protocol String.Chars not implemented for {"job", 155}
        (elixir) lib/string/chars.ex:3: String.Chars.impl_for!/1
        (elixir) lib/string/chars.ex:17: String.Chars.to_string/1
        (pg2pubsub) lib/pg2pubsub.ex:29: Pg2PubSub.subscribe/1
        (thumbs_up_ui) web/channels/job_channel.ex:7: ThumbsUpUi.JobChannel.join/3
        (phoenix) lib/phoenix/channel/server.ex:169: Phoenix.Channel.Server.init/1
        (stdlib) gen_server.erl:328: :gen_server.init_it/6
        (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3

Here is a fix to this problem 😄

@kbremner
Copy link
Owner

Glad it's of some use! I wrote it to try out PG2 but if it's useful then that's good to hear :)

Thanks for the PR, just 2 things. Could you update the spec statements, now that the methods can accept something other than strings, and could you add doc tests showing the use of a non-string topic?

If you could make those changes, I can get this merged!

@stmichael
Copy link
Author

Sorry, I forgot about that. How about now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants