Why I get [warn] Ignoring unmatched topic?

From time to time, I notice that my server logs an error:

[warn] Ignoring unmatched topic "buses:x" in MyApp.Schools.SchoolSocket

Sometimes, I restart the server and the warning is gone, sometimes I restart servers but the warning still there…
I don’t know how to fix this issue, please help!

$ elixir -v
Erlang/OTP 19 [erts-8.2.2] [source-1ca84a4] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Elixir 1.4.1

:phoenix, "~> 1.2.1"

I deploy by:

mix edeliver update production --branch=master --clean-deploy --verbose;
mix edeliver restart production;

That is the warning you will see when someone attempts to join a channel that you do not have a corresponding

channel "topic:*", MyApp.Web.TopicChannel

for in your MyApp.Web.UserSocket (or any other socket) file.

What are the channel definitions in your application? e.g.:

channel "buses:*", MyApp.Schools.BusChannel

So you are either missing a catch-all like “buses:*”, and instead have sth like “buses:something_literal” or you are missing a busses definition altogether.

In the socket file, I have:

channel "buses:*", MyApp.Schools.BusChannel

And here is my def:

def join(“buses:” <> bus_id, _params, socket) do
Logger.info “JOINED buses:#{bus_id}”
{:ok, socket}
end

it used to work, then it stopped working for some reason I don’t know…

The default Phoenix generated socket file is MyApp.Web.UserSocket. Your original post mentioned something about MyApp.Schools.SchoolSocket. Did you just rename that file and module, or do you have multiple sockets listed in your endpoint?

Do you have a repository that you would be able to show us?

I have two websockets, using two end points, MyApp.Schools.SchoolSocket can be reached using the second end point at port 4011, I will try to deploy the repo so that I can share it here

Sounds like you have code trying to access that one unmatched topic by accessing the other websocket then.

I think we have found the problem source, it’s that we were joining channel before waiting socket to get actually opened at android side :expressionless:, I am not sure, but now we join channel only after the socket got opened.

Will update here if this is actually the issue…

Hmm seems like that should not happen, if you can replicate that I’d love to see a reproducible minimized example. :slight_smile:

I will try to have reproducible minimized example when possible, as currently we are trying to launch the product :slight_smile:

Ok, I found the scenario, I am using [eoinsha] (https://github.com/eoinsha/JavaPhoenixChannels)'s android client.

*1. connect the socket.
*2. when connected, join the channel
*3. the channel is successfully joined
*4. start pushing (long, lat) message to the joined channel, each 5 seconds. This works fine, and the message is broadcasted as expected inside the topic at server side.

~~ now produce the issue ~~

*5. disconnect the phone internet connection.
*6. reconnect the phone internet connection.
*7. the client will try to re-connect the socket again.
*8. the client successfully reconnect
*9. my app is trying to push data to the channel as it did in step 4, then, I will start seeing the error at server side:

     [warn] Ignoring unmatched topic "buses:x" in MyApp.Schools.SchoolSocket
1 Like

Sounds like that client is not rejoining the topics after a reconnect. It needs to do the same stuff that the official phoenix client does.

So, where can I find the official android client of phoenix? Is this case
handled in it?

I don’t believe there is currently an official android client. You could always try to send in a pull request to the project if you are able to in order to fix an issue like this.

1 Like