Re: Django-channels disconnects right after sending a message

2017-02-22 Thread Nikoleta Misheva
I tried it and it works fine, but as soon as I try to hang this to a button it disconnects, so this line $('#arg_form').on('submit',function () is the problem, if I send message without hanging it to a button submit function it is ok with or without JSON.stringify сряда, 22 февруари 2017 г., 9

Re: Django-channels disconnects right after sending a message

2017-02-21 Thread Andrew Godwin
Then you need to add more and more back until it does disconnect and you should be able to find the line that's doing it! Andrew On Tue, Feb 21, 2017 at 11:03 PM, Nikoleta Misheva wrote: > I tried the simplest example and it works fine and does not disconnect. > > def websocket_receive(message

Re: Django-channels disconnects right after sending a message

2017-02-21 Thread Nikoleta Misheva
I tried the simplest example and it works fine and does not disconnect. def websocket_receive(message): text = message.content.get('text') if text: message.reply_channel.send({"text": "You said: {}".format(text)}) And using the JS console socket = new WebSocket("ws://" + window.location.hos

Re: Django-channels disconnects right after sending a message

2017-02-21 Thread Nikoleta Misheva
How do I log an WebsocketCloseExeption it might deliver more useful information? сряда, 22 февруари 2017 г., 3:08:09 UTC+2, Andrew Godwin написа: > > I'm afraid I don't really know what's going on then - the logs don't > reveal very much. I'd try reducing it down to simpler code until you can >

Re: Django-channels disconnects right after sending a message

2017-02-21 Thread Andrew Godwin
I'm afraid I don't really know what's going on then - the logs don't reveal very much. I'd try reducing it down to simpler code until you can replicate it in only a few lines and work from there. Andrew On Tue, Feb 21, 2017 at 11:46 AM, Nikoleta Misheva wrote: > I don't know how to get the clos

Re: Django-channels disconnects right after sending a message

2017-02-21 Thread Nikoleta Misheva
I don't know how to get the close code. It disconnects right after you hit the send button but it manages to send the message, I had prints and the message was right and etc but was always after disconnect. My disconnect function basically deletes the room. And python's console logs: [2017/02/21

Re: Django-channels disconnects right after sending a message

2017-02-21 Thread Andrew Godwin
How does it disconnect? What WebSocket close code do you get? (You'll need to add JS to log it) What prints on the Python console? Andrew On Tue, Feb 21, 2017 at 12:27 AM, Nikoleta Misheva wrote: > When I send message the websocket disconnects. I am able to get the > message, but I can't procee

Django-channels disconnects right after sending a message

2017-02-21 Thread Nikoleta Misheva
When I send message the websocket disconnects. I am able to get the message, but I can't proceed further since disconnect is supposed to delete the room. I tested it with basic prints after every statement and it disconnects right after the receiver gets the message because everything that is i