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 [email protected].
To post to this group, send email to [email protected].
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to