Skip to content

Instantly share code, notes, and snippets.

@dsociative
Created May 30, 2012 14:46
Show Gist options
  • Save dsociative/2836758 to your computer and use it in GitHub Desktop.
Save dsociative/2836758 to your computer and use it in GitHub Desktop.
def run_callback(self, obj, args=None):
try:
assert hasattr(self, 'on%s' % obj)
f = getattr(self, 'on%s' % obj)
if args:
return f(args)
else:
return f()
except Exception as e:
rt = self.onerror(json.dumps(str(e), separators=(', ', ':')))
self.close()
return rt
def run_callback(self, obj, args=None):
assert hasattr(self, 'on%s' % obj)
f = getattr(self, 'on%s' % obj)
if args:
return f(args)
else:
return f()
@hf35
Copy link

hf35 commented May 30, 2012

Start server on 32180...
PUBLISH TO CHANNEL: 321:subscribe_to_online_users_list, data: {'action': 'onlineuserslist:add', 'data': {'listener': [], 'balance': [{'Currency': {'is_fun': True, 'id': 2L, 'short_name': u'GM', 'name': u'Game Money'}, 'Balance': 5500}], 'name': u'123qwe', 'urls': [None], 'country': [''], 'logged_in': True, 'unread': 0L, 'id': 965274711, 'chat_time': None}}
7 5reelslots
10 butterfly
1 chat
2 cowboys
3 drake
4 football
5 hunter
6 magician
8 sushi
9 vikings
PUBLISH TO CHANNEL: 321:subscribe_to_online_users_list, data: {'action': 'onlineuserslist:add', 'data': {'listener': [], 'balance': [{'Currency': {'is_fun': True, 'id': 2L, 'short_name': u'GM', 'name': u'Game Money'}, 'Balance': 5500}], 'name': u'123qwe', 'urls': [None], 'country': [''], 'logged_in': True, 'unread': 0L, 'id': 965274711, 'chat_time': None}}
7 5reelslots
10 butterfly
1 chat
2 cowboys
3 drake
4 football
5 hunter
6 magician
8 sushi
9 vikings
7 5reelslots
10 butterfly
1 chat
2 cowboys
3 drake
4 football
5 hunter
6 magician
8 sushi
9 vikings
Traceback (most recent call last):
File "/home/maxim/project/GameServer321/src/noodles/app.py", line 53, in noodlesapp
return response(env, start_response)
File "/home/maxim/project/GameServer321/src/noodles/websocket/websockhandler.py", line 120, in call
self.run_callback('message', WebSocketMessage(data))
File "/home/maxim/project/GameServer321/src/noodles/websocket/websockhandler.py", line 133, in run_callback
return f(args)
File "/home/maxim/project/GameServer321/src/noodles/websocket/websockhandler.py", line 266, in onmessage
channel_handler.onmessage(WebSocketMessage(msg.data['pkg']))
File "/home/maxim/project/GameServer321/src/user/game/api.py", line 71, in onmessage
apireq.AppID = Games.get_by_id(game_id).game_type_id
AttributeError: 'NoneType' object has no attribute 'game_type_id'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment