Skip to content

Commit

Permalink
BF: Update to new json handler.
Browse files Browse the repository at this point in the history
  • Loading branch information
Debilski committed Aug 29, 2017
1 parent 5139f15 commit b596cb5
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions pelita/ipython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@
import zmq
from zmq.eventloop.zmqstream import ZMQStream

from IPython.core.display import HTML
import os

from ..messaging.json_convert import json_converter
from ..datamodel import Wall, Food

import json
import pelita

class ZMQPubSub:
def __init__(self, callback):
Expand Down Expand Up @@ -64,11 +61,11 @@ def on_close(self):
print("WebSocket closed")

def on_data(self, data):
msg_objs = json_converter.loads(data[0].decode())

data = msg_objs.get("__data__") or {}
py_obj = json.loads(data[0].decode())
data = py_obj.get("__data__") or {}

universe = data.get("universe")
universe = pelita.datamodel.CTFUniverse._from_json_dict(universe)
game_state = data.get("game_state")
if universe:

Expand Down

0 comments on commit b596cb5

Please sign in to comment.