Monday, March 27, 2017

Re: Channels - logout not resetting message.user value on new WebSocket connections

Or make "accept": False do the same as "close": True. The reason that close is a separate argument is that you can pass a WebSocket close code, optionally (we have a default if you don't, but that's probably enough for most people)

Andrew

On Mon, Mar 27, 2017 at 6:37 AM, Melvyn Sopacua <m.r.sopacua@gmail.com> wrote:

On Sunday 26 March 2017 15:40:28 Andrew Godwin wrote:

 

> - The way to reject a socket connection is "close": True, not

> "accept": False; try changing to that

 

If there is no use case for 'accept': False, then it makes more sense to change the API to reply_channel.accept() and reply_channel.reject().

 

> > def ws_connect(message, slug):

> > if message.user.is_authenticated():

> > message.reply_channel.send({"accept": True})

> >

> > else:

> > message.reply_channel.send({"accept": False})

 

My 2c.

--

Melvyn Sopacua

--
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+unsubscribe@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/1606140.jmrvaBkSz8%40devstation.

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+unsubscribe@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/CAFwN1uoCQ_Q5F%3DfkYrtn5zS9P3aonj_B61h4J36ayTsg5VQz2w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment