Commits

Jeffrey Gelens committed 7f5715f

Updated examples to reflect the latest changes.

Comments (0)

Files changed (4)

 
 *.pyc
 *.sw?
-gevent_websocket.egg-info/*
 tests/testresults.sqlite3
 .vfenv

examples/plot_graph.html

 	var iets = "";
 	window.onload = function() {
 		var data = {};
-		try {
-			var s = new WebSocket("ws://localhost:8000/data");
-		}
-		catch (e) {
-			var s = new MozWebSocket("ws://localhost:8000/data");
-		}
+        var s = new WebSocket("ws://localhost:8000/data");
+
 		s.onopen = function() {
 			s.send('hi');
 		};

examples/plot_graph.py

         plot_graph:app
 """
 
+
 import gevent
-import os
+import logging
 import random
 
-from gevent import pywsgi
-from geventwebsocket.handler import WebSocketHandler
+from geventwebsocket.server import WebSocketServer
 
 
+logger = logging.getLogger(__name__)
+logger = logging.getLogger(__name__)
+logger.setLevel(logging.DEBUG)
+
 def handle(ws):
     """
     This is the websocket handler function. Note that we can dispatch based on
 
 
 if __name__ == "__main__":
-    server = pywsgi.WSGIServer(("", 8000), app,
-        handler_class=WebSocketHandler)
+    server = WebSocketServer(('', 8000), app, debug=True)
     server.serve_forever()
         self.register_procedure("http://localhost:8000/calc#add", self.add)
         self.register_object("http://localhost:8000/test#", RPCTestClass)
 
-    def add(self, x, y):
-        return x + y
+    def add(self, var, has):
+        has.update({'bloep': var})
+        return has
 
 
 def app(environ, start_response):