Permalink
Browse files

test

  • Loading branch information...
peterbe committed Apr 21, 2012
1 parent 3774c50 commit 46c928670b580da271cc4c242a9dde3818c1c057
Showing with 9 additions and 2 deletions.
  1. +8 −0 app.py
  2. +1 −2 static/socktest.js
View
8 app.py
@@ -22,6 +22,13 @@ def get(self):
data = {'count': int(count) + 1}
self.write(data)
+class HomeHandler(tornado.web.RequestHandler):
+ def get(self):
+ self.write("""<html>
+ <a href=/socktest>socktest</a><br>
+ <a href=/ajaxtest>ajaxtest</a><br>
+ </html>""")
+
def app():
app_settings = dict(
static_path=os.path.join(os.path.dirname(__file__), "static"),
@@ -30,6 +37,7 @@ def app():
)
return tornado.web.Application([
+ (r"/", HomeHandler),
(r"/socktest", SockHandler),
(r"/ajaxtest", AjaxHandler),
(r"/ajaxecho", AjaxEchoHandler),
View
@@ -7,9 +7,8 @@ SockJS.prototype.send_json = function(data) {
var loop = (function() {
var data_function;
var sock;
-
var initsock = function(callback) {
- sock = new SockJS('http://localhost:9999/echo');
+ sock = new SockJS('http://' + location.hostname + ':9999/echo');
sock.onmessage = function(e) {
master_count = e.data.count;

0 comments on commit 46c9286

Please sign in to comment.