aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/web/app.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2014-09-17 13:58:56 +1200
committerAldo Cortesi <aldo@nullcube.com>2014-09-17 13:58:56 +1200
commitb4ecd96beb77a8bae02d82eac174dded198797a3 (patch)
tree1868202264b5e201338698b76dbed5104448ec28 /libmproxy/web/app.py
parent51db9a5612f0899ed61751dbee3f4e4b19a74ea4 (diff)
downloadmitmproxy-b4ecd96beb77a8bae02d82eac174dded198797a3.tar.gz
mitmproxy-b4ecd96beb77a8bae02d82eac174dded198797a3.tar.bz2
mitmproxy-b4ecd96beb77a8bae02d82eac174dded198797a3.zip
Introduce short form object state, and connect the ends to send data to web app
Diffstat (limited to 'libmproxy/web/app.py')
-rw-r--r--libmproxy/web/app.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/libmproxy/web/app.py b/libmproxy/web/app.py
index e9bcc526..e2765a6d 100644
--- a/libmproxy/web/app.py
+++ b/libmproxy/web/app.py
@@ -2,6 +2,7 @@ import os.path
import tornado.web
import tornado.websocket
import logging
+import json
class IndexHandler(tornado.web.RequestHandler):
@@ -22,7 +23,14 @@ class ClientConnection(tornado.websocket.WebSocketHandler):
def broadcast(cls, type, data):
for conn in cls.connections:
try:
- conn.write_message(type, data)
+ conn.write_message(
+ json.dumps(
+ {
+ "type": type,
+ "data": data
+ }
+ )
+ )
except:
logging.error("Error sending message", exc_info=True)