Permalink
Browse files

7

  • Loading branch information...
1 parent 3e13911 commit 112f8eeefd63fc7331f49e198a3053197fb1679e @Limfocit committed Aug 12, 2011
Showing with 6 additions and 13 deletions.
  1. +5 −1 connection_handler.py
  2. +1 −12 static/simplechat.js
View
@@ -17,7 +17,11 @@ def handle_disconnection(channel_id):
class ChannelConnectHandler(webapp.RequestHandler):
def post(self):
- pass
+ channel_id = self.request.get('from')
+ q = OnlineUser.all().filter('channel_id =', channel_id)
+ user = q.fetch(1)[0]
+ user.opened_socket = True
+ user.put()
class ChannelDisconnectHandler(webapp.RequestHandler):
View
@@ -30,18 +30,7 @@ $(document).ready(function(){
var chat_token = $('#channel_api_params').attr('chat_token');
var channel = new goog.appengine.Channel(chat_token);
var socket = channel.open();
- socket.onopen = function(){
- $.ajax({
- url: '/open_socket/',
- type: 'POST',
- data:{
- channel_id:$('#channel_api_params').attr('channel_id'),
- },
- success: function(data){
- },
- complete:function(){
- }
- });
+ socket.onopen = function(){
};
socket.onmessage = function(m){
var data = $.parseJSON(m.data);

0 comments on commit 112f8ee

Please sign in to comment.