Yes. That what was indeed happening. Please see a more detailed thread - the one I said Google Groups didn't post <https://groups.google.com/forum/#!topic/django-users/mG1h85X0Uhc>. (The update I posted there actually isn't really a solution because I discovered later it doesn't work)
Now I've got it working, but I could *swear* this exact same setup didn't work for me before: root/routing.py channel_routing = [ include('core.routing.home_routing', path=r'^/$'), include('core.routing.fb_routing', path=r'^/import/$'), ] home_routing = [ route('websocket.connect', consumers.ws_connect), route('websocket.disconnect', consumers.ws_disconnect), route('websocket.receive', consumers.ws_receive), ] fb_routing = [ route("websocket.receive", consumers.get_face), ] Maybe having `websocket.connect` in both lists was the culprit? this issue was *super* confusing. If you want, Andrew, I could re-configure my routing to look as before and send you some details for debugging. I could swear the same setup as above was giving both or only one of the consumers working, but never either as it should. On Tuesday, December 19, 2017 at 8:24:59 PM UTC+2, Andrew Godwin wrote: > > What you describe there seems like a bug - the first include() should be > adding path restrictions. What's confusing is that you said _both_ > consumers are getting called? As in each event goes to two routing entries? > That definitely shouldn't happen. > > Andrew > > On Tue, Dec 19, 2017 at 4:07 AM, SK <shib...@gmail.com <javascript:>> > wrote: > >> So I just spent quite an amount of time posting a lengthy question with >> specifics and examples but Google Groups simply didn't post. >> >> I'll make this short: >> >> In github issue below Andew writes: >> >> Ah, well that's because you don't have a path key in your message - the >>> routing isn't magical, it just goes off of the contents of the message. >>> websocket.connect and websocket.receive messages include a path key so they >>> can be routed, whereas yours just has a message key. >>> *Given you have made a separate channel especially for this, there's no >>> need for the path routing unless you really want to distinguish it, in >>> which case you should ensure a path is added to the message when it's sent >>> onto the channel.* >> >> >> Emphasis mine. Does that mean I *don't have *to parse the path in each >> of my consumers in order for them to not send a message down to the same >> message. >> >> Even with this setup, which as I understand should separate between the >> different consumers per socket: >> >> fb_routing = [ >> route("websocket.connect", consumers.connect_face), >> route("websocket.receive", consumers.get_face), >> route("websocket.disconnect", consumers.disconnect_face) >> ] >> >> >> channel_routing = [ >> include(fb_routing, path=r'^/import/$'), >> route('websocket.connect', consumers.ws_connect), >> route('websocket.disconnect', consumers.ws_disconnect), >> route('websocket.receive', consumers.ws_receive), >> ] >> >> >> Both consumers are getting called when I send a message from Javascript >> with the path: >> >> var ws_scheme = window.location.protocol == "http:" ? "ws" : "wss"; >> var ws_path = ws_scheme + '://' + window.location.host + "/import"; >> console.log("Connecting to " + ws_path); >> var mysocket = new ReconnectingWebSocket(ws_path); >> >> >> So as I understand it now, there's no way to prevent both consumers >> listening to websocket.connect from getting the message, I can only >> prevent them from sending the wrong message to the wrong group? >> >> All I want to achieve is to have a separate websocket and its set of >> consumers on `/import` so I don't have to do multiple if clauses. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users...@googlegroups.com <javascript:>. >> To post to this group, send email to django...@googlegroups.com >> <javascript:>. >> Visit this group at https://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/91b500bc-fcc9-4d44-b9ee-ef91de9ddd70%40googlegroups.com >> >> <https://groups.google.com/d/msgid/django-users/91b500bc-fcc9-4d44-b9ee-ef91de9ddd70%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0b495981-b685-4a12-bf4a-6cc0e2bbbd2f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.