Commits

vl...@vlad-Vostro-3500  committed 8776a65 Draft

fix channel api bugs

  • Participants
  • Parent commits 1acb01e

Comments (0)

Files changed (3)

File common/services.py

     else:
         obj, created = UserChannel.objects.get_or_create(client_id = client_id, defaults={})
 
-    obj.page_url = request.path
+    obj.page_url = request.POST['pathname']
     obj.client_id=client_id
     obj.connected = True
 

File common/views.py

 
     users = [obj.user for obj in UserChannel.objects.filter(connected=True, page_url = request.GET['path'])]
 
-    json_users = [_user_to_json(user) for user in users]
+    json_users = [_user_to_json(user) for user in users ]
 
     data = simplejson.dumps(json_users)
     return HttpResponse(data)

File templates/map.html

 <script type="text/javascript" src="/_ah/channel/jsapi"></script>
 {% if user.is_authenticated %}
     <script>
+
         var channel = new goog.appengine.Channel('{{ request.token }}');
-
         var socket = channel.open();
         onOpened = function() {
             var connected = true;
-            var payload = {'type':'join'};
+            var payload = {'type':'join','pathname':location.pathname};
             $.ajax({
                 type: "POST",
                 url:'{% url client_connected %}',
                     }
                     break;
                 case "check_online_users":
-//                        alert("check online users");
                     window.online_users.poll();
                     break;
             }