For some reason when I query the database it does not return the right 
values, tho they are there. For example instead the socket name it returns 
the username and instead of the username it returns some number

понеделник, 6 февруари 2017 г., 2:29:12 UTC+2, Andrew Godwin написа:
>
> You likely need a consumer tied to `websocket.disconnect` that deletes 
> rows from the databases as sockets disconnect.
>
> On Sun, Feb 5, 2017 at 6:58 AM, Nikoleta Misheva <nith...@gmail.com 
> <javascript:>> wrote:
>
>> So the problem is with deleting the record and while it is not deleted it 
>> always get's into one case. I manually deleted the row and it connects to 
>> the websocket with no problem, the problem was that instead of  'message' I 
>> should put 'text'. So the main problem is with deleting user_topair. The 
>> other main problem is with connecting the second person, connecting one 
>> person works fine but as soon as I try to connect the second person it 
>> gives me the error that the connection closed tho since it reconnects it 
>> creates like 7 rows in the database. Any ideas on how to solve?
>>
>>
>> неделя, 5 февруари 2017 г., 10:29:36 UTC+2, Nikoleta Misheva написа:
>>>
>>> I managed to run it somehow but now it says that the socket closed 
>>> before it was able to connect and from the logs I got 
>>> ERROR - worker - Error processing message with consumer play.consumers.
>>> ws_connect:
>>>
>>> I am not sending any message from javascript. So I suppose the error is 
>>> in ws_connect. The final error however is  
>>> ValueError: invalid literal for int() with base 10: 
>>> 'websocket.send!ICANvzjn'
>>>
>>>
>>> Here is my ws_connect:
>>>
>>> @channel_session_user_from_http
>>> def ws_connect(message):
>>>     # message.reply_channel.send({'accept': True})
>>>
>>>     username = message.user.username
>>>     reply_channel_name = message.reply_channel.name
>>>
>>>     waiting_users = OnlineUsers.objects.all()
>>>     # If there are waiting users connect to one of them
>>>     if waiting_users:
>>>         user_topair = waiting_users.first()
>>>         pair = PairUsers()
>>>         pair.username_a = username
>>>         pair.username_b = user_topair.username
>>>         pair.reply_channel_a = reply_channel_name
>>>         pair.reply_channel_b = user_topair.reply_channel_name
>>>         pair.save()
>>>         print(user_topair)
>>>         user_topair.delete()
>>>
>>>     else:
>>>         # else put the user on the waiting list
>>>         OnlineUsers(username, reply_channel_name).save()
>>>         message.reply_channel.send({'message': "Please wait while we find a 
>>> user to pair you with"})
>>>
>>>
>>>
>>>
>>> неделя, 5 февруари 2017 г., 2:11:46 UTC+2, Andrew Godwin написа:
>>>>
>>>> If you ever see "Unexpected response code: 200" it means that something 
>>>> between you and the server doesn't understand WebSockets. Given it's 
>>>> localhost in this case, have you installed channels and make sure it's in 
>>>> INSTALLED_APPS, then run `runserver`?
>>>>
>>>> Andrew
>>>>
>>>> On Sat, Feb 4, 2017 at 3:20 AM, Nikoleta Misheva <nith...@gmail.com> 
>>>> wrote:
>>>>
>>>>> When I use django-channels with reconnecting websocket 
>>>>> <https://github.com/joewalnes/reconnecting-websocket> without redis 
>>>>> backend and try to connect to ws://localhost:8000/play it returns 
>>>>> Error during WebSocket handshake: Unexpected response code: 200
>>>>> But when I use the redis backend and even tho the workers are running 
>>>>> and etc I can't connect to my site it just loads forever and doesn't even 
>>>>> end up in connection timeout.
>>>>> I would be glad if someone can help me. Here 
>>>>> <https://gist.github.com/Nitheism/f1434ce35089cee37ebb658cbec6a09b> 
>>>>> is the gist with my code because the files are too many and it would be 
>>>>> hard to put them in here, sorry for the inconvenience.
>>>>>
>>>>> -- 
>>>>> 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.
>>>>> To post to this group, send email to django...@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/454151ae-1631-45df-881c-0dfdaf8f180f%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/django-users/454151ae-1631-45df-881c-0dfdaf8f180f%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...@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/511447f2-03c7-4b5a-9558-916617a60aeb%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/511447f2-03c7-4b5a-9558-916617a60aeb%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/c6583c20-cc9c-4cdd-956b-c1db82a899b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to