Monday, March 27, 2017

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

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

No comments:

Post a Comment