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:27:32 UTC+2, 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):
>>  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.host + "/chat/");
>> socket.onmessage = function(e) {
>> alert(e.data);
>> }
>> socket.onopen = function() {
>> socket.send("hello world");
>> }
>>
>> сряда, 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 
>>> 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 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 21:42:50] WebSocket DISCONNECT /play [127.0.0.1:65273]
>>>> [2017/02/21 21:42:50] WebSocket HANDSHAKING /play [127.0.0.1:65282]
>>>> It reconnects.
>>>>
>>>>
>>>> вторник, 21 февруари 2017 г., 20:45:13 UTC+2, 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 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 in ws_receive is printed after it disconnects
>>>>>>
>>>>>> My consumer:
>>>>>>
>>>>>> @channel_session_user
>>>>>> def ws_receive(message):
>>>>>>  username = message.user.username
>>>>>>  text = json.loads(message['text']).get('text')
>>>>>>  # Use my algorithm here
>>>>>>  score = score_argument.get_rating(text)
>>>>>>  # find the room with our users
>>>>>>  # print(type(username))
>>>>>>  # print(username)
>>>>>>  current_room = get_object_or_404(PairUsers, Q(username_a=username) | 
>>>>>> Q(username_b=username))
>>>>>>
>>>>>>  # current_room = PairUsers.objects.filter(Q(username_a=username) | 
>>>>>> Q(username_b=username)).first()
>>>>>>
>>>>>>  # check which user you got and send the message to the other
>>>>>>  if current_room.username_b == username:
>>>>>>  current_room.score_b = score
>>>>>>  other_channel = Channel(current_room.reply_channel_a)
>>>>>>  message.reply_channel.send({'text': json.dumps({
>>>>>>  "message": text,
>>>>>>  "user": username, }),
>>>>>>  })
>>>>>>  message.reply_channel.send({'text': json.dumps({
>>>>>>  "score": score,
>>>>>>  "user": username, }),
>>>>>>  })
>&g

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.host + "/chat/");
socket.onmessage = function(e) {
alert(e.data);
}
socket.onopen = function() {
socket.send("hello world");
}

сряда, 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 
> 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 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 21:42:50] WebSocket DISCONNECT /play [127.0.0.1:65273]
>> [2017/02/21 21:42:50] WebSocket HANDSHAKING /play [127.0.0.1:65282]
>> It reconnects.
>>
>>
>> вторник, 21 февруари 2017 г., 20:45:13 UTC+2, 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 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 in ws_receive is printed after it disconnects
>>>>
>>>> My consumer:
>>>>
>>>> @channel_session_user
>>>> def ws_receive(message):
>>>>  username = message.user.username
>>>>  text = json.loads(message['text']).get('text')
>>>>  # Use my algorithm here
>>>>  score = score_argument.get_rating(text)
>>>>  # find the room with our users
>>>>  # print(type(username))
>>>>  # print(username)
>>>>  current_room = get_object_or_404(PairUsers, Q(username_a=username) | 
>>>> Q(username_b=username))
>>>>
>>>>  # current_room = PairUsers.objects.filter(Q(username_a=username) | 
>>>> Q(username_b=username)).first()
>>>>
>>>>  # check which user you got and send the message to the other
>>>>  if current_room.username_b == username:
>>>>  current_room.score_b = score
>>>>  other_channel = Channel(current_room.reply_channel_a)
>>>>  message.reply_channel.send({'text': json.dumps({
>>>>  "message": text,
>>>>  "user": username, }),
>>>>  })
>>>>  message.reply_channel.send({'text': json.dumps({
>>>>  "score": score,
>>>>  "user": username, }),
>>>>  })
>>>>  other_channel.send({'text': json.dumps({
>>>>  "message": text,
>>>>  "user": username, }),
>>>>  })
>>>>  other_channel.send({'text': json.dumps({
>>>>  "score": score,
>>>>  "user": username, }),
>>>>  })
>>>>  else:
>>>>  current_room.score_a = score
>>>>  other_channel = Channel(current_room.reply_channel_b)
>>>>  message.reply_channel.send({'text': json.dumps({
>>>>  "message": text,
>>>>  "user": username, }),
>>>>  })
>>>>  message.reply_channel.send({'text': json.dumps({
>>>>  "score": score,
>>>>  "user": username, }),
>>>>  })
>>>>  other_channel.send({'text': json.dumps({
>>>>  "message": text,
>>>>  "user": username, }),
>>>>  })
>>>>  other_channel.send({'text': json.dumps({
>>>>  "score": score,
>>>>  "user": username, }),
>>>>  

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 
> 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 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 21:42:50] WebSocket DISCONNECT /play [127.0.0.1:65273]
>> [2017/02/21 21:42:50] WebSocket HANDSHAKING /play [127.0.0.1:65282]
>> It reconnects.
>>
>>
>> вторник, 21 февруари 2017 г., 20:45:13 UTC+2, 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 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 in ws_receive is printed after it disconnects
>>>>
>>>> My consumer:
>>>>
>>>> @channel_session_user
>>>> def ws_receive(message):
>>>>  username = message.user.username
>>>>  text = json.loads(message['text']).get('text')
>>>>  # Use my algorithm here
>>>>  score = score_argument.get_rating(text)
>>>>  # find the room with our users
>>>>  # print(type(username))
>>>>  # print(username)
>>>>  current_room = get_object_or_404(PairUsers, Q(username_a=username) | 
>>>> Q(username_b=username))
>>>>
>>>>  # current_room = PairUsers.objects.filter(Q(username_a=username) | 
>>>> Q(username_b=username)).first()
>>>>
>>>>  # check which user you got and send the message to the other
>>>>  if current_room.username_b == username:
>>>>  current_room.score_b = score
>>>>  other_channel = Channel(current_room.reply_channel_a)
>>>>  message.reply_channel.send({'text': json.dumps({
>>>>  "message": text,
>>>>  "user": username, }),
>>>>  })
>>>>  message.reply_channel.send({'text': json.dumps({
>>>>  "score": score,
>>>>  "user": username, }),
>>>>  })
>>>>  other_channel.send({'text': json.dumps({
>>>>  "message": text,
>>>>  "user": username, }),
>>>>  })
>>>>  other_channel.send({'text': json.dumps({
>>>>  "score": score,
>>>>  "user": username, }),
>>>>  })
>>>>  else:
>>>>  current_room.score_a = score
>>>>  other_channel = Channel(current_room.reply_channel_b)
>>>>  message.reply_channel.send({'text': json.dumps({
>>>>  "message": text,
>>>>  "user": username, }),
>>>>  })
>>>>  message.reply_channel.send({'text': json.dumps({
>>>>  "score": score,
>>>>  "user": username, }),
>>>>  })
>>>>  other_channel.send({'text': json.dumps({
>>>>  "message": text,
>>>>  "user": username, }),
>>>>  })
>>>>  other_channel.send({'text': json.dumps({
>>>>  "score": score,
>>>>  "user": username, }),
>>>>  })
>>>> The JS:
>>>>
>>>> $(function () {
>>>>  // Correctly decide between ws:// and wss://
>>>>  var ws_scheme = window.location.protocol == "https:" ? "wss" : "ws";
>>>>  var ws_path = ws_scheme + '://' + window.location.host + 
>>>> window.location.pathname;
>>>>  console.log(&

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 21:42:50] WebSocket DISCONNECT /play [127.0.0.1:65273]
[2017/02/21 21:42:50] WebSocket HANDSHAKING /play [127.0.0.1:65282]
It reconnects.


вторник, 21 февруари 2017 г., 20:45:13 UTC+2, 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 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 in ws_receive is printed after it disconnects
>>
>> My consumer:
>>
>> @channel_session_user
>> def ws_receive(message):
>>  username = message.user.username
>>  text = json.loads(message['text']).get('text')
>>  # Use my algorithm here
>>  score = score_argument.get_rating(text)
>>  # find the room with our users
>>  # print(type(username))
>>  # print(username)
>>  current_room = get_object_or_404(PairUsers, Q(username_a=username) | 
>> Q(username_b=username))
>>
>>  # current_room = PairUsers.objects.filter(Q(username_a=username) | 
>> Q(username_b=username)).first()
>>
>>  # check which user you got and send the message to the other
>>  if current_room.username_b == username:
>>  current_room.score_b = score
>>  other_channel = Channel(current_room.reply_channel_a)
>>  message.reply_channel.send({'text': json.dumps({
>>  "message": text,
>>  "user": username, }),
>>  })
>>  message.reply_channel.send({'text': json.dumps({
>>  "score": score,
>>  "user": username, }),
>>  })
>>  other_channel.send({'text': json.dumps({
>>  "message": text,
>>  "user": username, }),
>>  })
>>  other_channel.send({'text': json.dumps({
>>  "score": score,
>>  "user": username, }),
>>  })
>>  else:
>>  current_room.score_a = score
>>  other_channel = Channel(current_room.reply_channel_b)
>>  message.reply_channel.send({'text': json.dumps({
>>  "message": text,
>>  "user": username, }),
>>  })
>>  message.reply_channel.send({'text': json.dumps({
>>  "score": score,
>>  "user": username, }),
>>  })
>>  other_channel.send({'text': json.dumps({
>>  "message": text,
>>  "user": username, }),
>>  })
>>  other_channel.send({'text': json.dumps({
>>  "score": score,
>>  "user": username, }),
>>  })
>> The JS:
>>
>> $(function () {
>>  // Correctly decide between ws:// and wss://
>>  var ws_scheme = window.location.protocol == "https:" ? "wss" : "ws";
>>  var ws_path = ws_scheme + '://' + window.location.host + 
>> window.location.pathname;
>>  console.log("Connecting to " + ws_path);
>>  var socket = new ReconnectingWebSocket(ws_path);
>>
>>  socket.onmessage = function(message){
>>  var data = JSON.parse(message.data);
>>  if(!data.score){
>>  var element = $([
>>  "",
>>  "" + data.message + "",
>>  "",
>>  "" + data.user + "",
>>  "",
>>  ""
>>  ].join("\n"));
>>  $("#chat_table tbody").append(element);
>>  }
>>  else {
>>  var element = $([
>>  "",
>>  "" + data.user + "'s score is:" + data.score + "",
>>  ""
>>  ].join("\n"));
>>  $("#chat_table tbody").append(element);
>>
>>  }
>>  }
>>
>>  $('#arg_form').on('submit',function () {
>>  socket.send(JSON.stringify({
>>  "text": $('#argument').val()
>>  }))})
>>
>>  });
>> What might be the cause?
>>
>>
>>
>> -- 
>> You received this message because you are subs

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 in ws_receive is printed after it disconnects

My consumer:

@channel_session_user
def ws_receive(message):
 username = message.user.username
 text = json.loads(message['text']).get('text')
 # Use my algorithm here
 score = score_argument.get_rating(text)
 # find the room with our users
 # print(type(username))
 # print(username)
 current_room = get_object_or_404(PairUsers, Q(username_a=username) | 
Q(username_b=username))

 # current_room = PairUsers.objects.filter(Q(username_a=username) | 
Q(username_b=username)).first()

 # check which user you got and send the message to the other
 if current_room.username_b == username:
 current_room.score_b = score
 other_channel = Channel(current_room.reply_channel_a)
 message.reply_channel.send({'text': json.dumps({
 "message": text,
 "user": username, }),
 })
 message.reply_channel.send({'text': json.dumps({
 "score": score,
 "user": username, }),
 })
 other_channel.send({'text': json.dumps({
 "message": text,
 "user": username, }),
 })
 other_channel.send({'text': json.dumps({
 "score": score,
 "user": username, }),
 })
 else:
 current_room.score_a = score
 other_channel = Channel(current_room.reply_channel_b)
 message.reply_channel.send({'text': json.dumps({
 "message": text,
 "user": username, }),
 })
 message.reply_channel.send({'text': json.dumps({
 "score": score,
 "user": username, }),
 })
 other_channel.send({'text': json.dumps({
 "message": text,
 "user": username, }),
 })
 other_channel.send({'text': json.dumps({
 "score": score,
 "user": username, }),
 })
The JS:

$(function () {
 // Correctly decide between ws:// and wss://
 var ws_scheme = window.location.protocol == "https:" ? "wss" : "ws";
 var ws_path = ws_scheme + '://' + window.location.host + 
window.location.pathname;
 console.log("Connecting to " + ws_path);
 var socket = new ReconnectingWebSocket(ws_path);

 socket.onmessage = function(message){
 var data = JSON.parse(message.data);
 if(!data.score){
 var element = $([
 "",
 "" + data.message + "",
 "",
 "" + data.user + "",
 "",
 ""
 ].join("\n"));
 $("#chat_table tbody").append(element);
 }
 else {
 var element = $([
 "",
 "" + data.user + "'s score is:" + data.score + "",
 ""
 ].join("\n"));
 $("#chat_table tbody").append(element);

 }
 }

 $('#arg_form').on('submit',function () {
 socket.send(JSON.stringify({
 "text": $('#argument').val()
 }))})

 });
What might be the cause?



-- 
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/301c0b6a-822b-46b5-b7b6-72263786361f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: PostgreSQL get_object_or_404 matching query does not exist when indeed it does?

2017-02-18 Thread Nikoleta Misheva
I missed that it is message.user.username when pasting it here but anyway 
it does not work. I checked it's class and it is str

събота, 18 февруари 2017 г., 21:47:27 UTC+2, Daniel Roseman написа:
>
> On Saturday, 18 February 2017 17:37:49 UTC, Nikoleta Misheva wrote:
>>
>> I am querying PostgreSQL using  *get_object_or_404  *  but it throws and 
>> exception  *PairUsers matching query does not exist  *and after that *During 
>> handling of the above exception, another exception 
>> occurred:django.http.response.Http404: No PairUsers matches the given query 
>> *when indeed I have a record in my db that matches the query and I am 
>> sure I am comparing the right values. How should I fix that?
>> Here is the corresponding code:
>>
>> @channel_session_user
>> def ws_receive(message):
>>  username = message.user
>>  text = json.loads(message['text']).get('text')
>>  # Use my algorithm here
>>  score = score_argument.get_rating(text)
>>  # find the room with our users
>>  print(username)
>>  current_room = get_object_or_404(PairUsers, Q(username_a=username) | 
>> Q(username_b=username))
>>  # current_room = PairUsers.objects.filter(Q(username_a=username) | 
>> Q(username_b=username))
>>
>>  # check which user you got and send the message to the other
>>  if current_room.username_b == username:
>>  current_room.score_b = score
>>  other_channel = Channel(current_room.reply_channel_a)
>>  message.reply_channel.send({'text': text})
>>  other_channel.send({'text': text})
>>  else:
>>  current_room.score_a = score
>>  other_channel = Channel(current_room.reply_channel_b)
>>  message.reply_channel.send({'text': text})
>>  other_channel.send({'text': text})
>>
>>
> Are you sure `message.user` is the same type as  `PairUsers.username_a` or 
> `PairUsers.username_b`? It sounds like one is an instance of User and one 
> is a character username (although it would be weird to use a username 
> there, in which case you should really rename the field).
>
> In any case, you should show your PairUsers model and whatever class 
> `message` is.
> --
> DR.
>

-- 
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/9b5044db-51c1-4991-9877-669256aff910%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


PostgreSQL get_object_or_404 matching query does not exist when indeed it does?

2017-02-18 Thread Nikoleta Misheva
I am querying PostgreSQL using  *get_object_or_404  *  but it throws and 
exception  *PairUsers matching query does not exist  *and after that *During 
handling of the above exception, another exception 
occurred:django.http.response.Http404: No PairUsers matches the given query 
*when indeed I have a record in my db that matches the query and I am sure 
I am comparing the right values. How should I fix that?
Here is the corresponding code:

@channel_session_user
def ws_receive(message):
 username = message.user
 text = json.loads(message['text']).get('text')
 # Use my algorithm here
 score = score_argument.get_rating(text)
 # find the room with our users
 print(username)
 current_room = get_object_or_404(PairUsers, Q(username_a=username) | 
Q(username_b=username))
 # current_room = PairUsers.objects.filter(Q(username_a=username) | 
Q(username_b=username))

 # check which user you got and send the message to the other
 if current_room.username_b == username:
 current_room.score_b = score
 other_channel = Channel(current_room.reply_channel_a)
 message.reply_channel.send({'text': text})
 other_channel.send({'text': text})
 else:
 current_room.score_a = score
 other_channel = Channel(current_room.reply_channel_b)
 message.reply_channel.send({'text': text})
 other_channel.send({'text': text})

-- 
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/1c2a1700-0759-426d-940c-3dcfa8c2b4c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-channels can't connect to websocket server. But when I am using redis I can't connect to my site at all.

2017-02-06 Thread Nikoleta Misheva
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  > 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  
>>>> 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 i

Re: Django-channels can't connect to websocket server. But when I am using redis I can't connect to my site at all.

2017-02-05 Thread Nikoleta Misheva
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  
>> 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+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/511447f2-03c7-4b5a-9558-916617a60aeb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-channels can't connect to websocket server. But when I am using redis I can't connect to my site at all.

2017-02-05 Thread 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  > 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+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/6ae0deb8-3c2a-46cb-bb0f-13cc6efd02e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-channels can't connect to websocket server. But when I am using redis I can't connect to my site at all.

2017-02-04 Thread Nikoleta Misheva
yes I have installed channels and it is in django installed apps. Another 
thing I see is that in the logs it says connecting localhost. HTTP/1.1 
with code 200 so it is not making a websocket at all?

неделя, 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  > 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+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/b31f273f-8e2a-41f2-b476-c88b8c410803%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-channels can't connect to websocket server. But when I am using redis I can't connect to my site at all.

2017-02-04 Thread Nikoleta Misheva
yes I have installed channels and it is in django installed apps

неделя, 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  > 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+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/87e2cf14-e5cf-4e10-9ddd-56344c85df23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django-channels can't connect to websocket server. But when I am using redis I can't connect to my site at all.

2017-02-04 Thread Nikoleta Misheva
When I use django-channels with 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 
 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+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/454151ae-1631-45df-881c-0dfdaf8f180f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Wiring django-channels to html without javascript?

2017-01-29 Thread Nikoleta Misheva
I used the console to test my app but now I want to wire my django-channels 
app to the html but I don't know any JS so is it possible to wire 
django-channels to html without using javascript? If it is possible how? 
Here  you 
can check my consumers.py and html template. I know less than 5% JS so any 
help would be appreciated :)

-- 
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/2ce32eb5-e117-48f1-9fa8-eb4d050ea142%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-channels save reply channel to django model field?

2017-01-19 Thread Nikoleta Misheva
So for example when I need the reply channel in the ws recieve method I 
need to create the Channel again and it will be the same channel referring 
to the same user? And do I have to delete the newly created channel after 
each ws recieve method?

четвъртък, 19 януари 2017 г., 20:25:41 UTC+2, Andrew Godwin написа:
>
> Hi,
>
> Channel isn't a field type - it's a separate datastructure entirely from a 
> database/Django models and is powered by its own code and servers (the 
> channel layer).
>
> If you want to persist the name of a reply_channel for use later, like 
> knowing what channel connections are on to send information down, then use 
> a CharField(max_length=255), and put the name of the channel in that (which 
> is usually reply_channel.name). You can then take the string name and 
> pass it to channel to make it again like Channel(reply_channel_name).
>
> Hope that helps,
> Andrew
>
> On Thu, Jan 19, 2017 at 6:57 AM, Nikoleta Misheva  > wrote:
>
>> Hello, sorry to bother you but how do you make a django-channels  Channel 
>> field in a Django model? I tried to use ForeignKey and ForeignObject but 
>> doesn't do the work.
>> Thank you in advance :)
>>
>> -- 
>> 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/ace270a5-ccba-43b2-aa54-bc425de9f709%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/ace270a5-ccba-43b2-aa54-bc425de9f709%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/b1626db4-9818-4c77-bc31-48ce5d9a6d0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django-channels save reply channel to django model field?

2017-01-19 Thread Nikoleta Misheva
Hello, sorry to bother you but how do you make a django-channels  Channel 
field in a Django model? I tried to use ForeignKey and ForeignObject but 
doesn't do the work.
Thank you in advance :)

-- 
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/ace270a5-ccba-43b2-aa54-bc425de9f709%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-channels connecting 2 random people

2017-01-14 Thread Nikoleta Misheva
Would it be a good idea to add everyone that has an open connection to a 
list of dictionaries and when 2 people are connected to remove them from 
the list? And how can I guarantee that the channels limit is just 2 and 
there won't be anyone joining by mistake? Or I just didn't get your idea. 
Thanks for the spent time :)

събота, 14 януари 2017 г., 22:51:59 UTC+2, Andrew Godwin написа:
>
> Your best bet is probably to use a database to track who's currently got 
> an open connection and their reply channel, and then use database rows to 
> match pairs together (in another table).
>
> Your message received code can then look up the other side in the table 
> and forward it to that reply channel. I don't think groups would help too 
> much here.
>
> Andrew
>
> On 14 Jan 2017 12:41, "Nikoleta Misheva" > 
> wrote:
>
>> Hello fellows, I started to go into channels and I saw the example for 
>> multiplex chat but it is not excactly what I want and I will be happy if 
>> someone can point me in the right direction or show me an example.
>> So I want to have many dynamically created rooms than will be destroyed 
>> after the session which the multiplexing example  here 
>> <https://github.com/andrewgodwin/channels-examples/tree/master/multichat> 
>> takes 
>> care of. But want I specifically want to do is to have only 2 people in a 
>> room randomly matched and connected. 
>>
>> *Here is an example: *
>> User1 clicks a button and user2 clicks the button too and so they are in 
>> something like a list with people that are online, then I randomly pick the 
>> 2 of them to connect to each other in a private room only for them which 
>> will be destroyed when  they left
>>
>> Thank you in advance
>>
>> -- 
>> 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/fae01772-7a30-4552-a104-0e5f519733de%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/fae01772-7a30-4552-a104-0e5f519733de%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/313561f4-9d87-4d42-aa86-516cde037ee6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django-channels connecting 2 random people

2017-01-14 Thread Nikoleta Misheva
Hello fellows, I started to go into channels and I saw the example for 
multiplex chat but it is not excactly what I want and I will be happy if 
someone can point me in the right direction or show me an example.
So I want to have many dynamically created rooms than will be destroyed 
after the session which the multiplexing example  here 
 takes 
care of. But want I specifically want to do is to have only 2 people in a 
room randomly matched and connected. 

*Here is an example: *
User1 clicks a button and user2 clicks the button too and so they are in 
something like a list with people that are online, then I randomly pick the 
2 of them to connect to each other in a private room only for them which 
will be destroyed when  they left

Thank you in advance

-- 
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/fae01772-7a30-4552-a104-0e5f519733de%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.