From 317b0f79a8e6e74380de54d4bbc379e91602bacf Mon Sep 17 00:00:00 2001 From: Brandon Stafford Date: Mon, 22 Jul 2013 15:22:44 -0400 Subject: [PATCH] Convert tabs to spaces to fix indentation error The uwsgi.websocket_handshake call on line 52 was not indented properly, causing the Python interpreter to choke. Converting the few tabs sprinkled through the document to spaces fixes that error. --- tests/websockets_echo.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/websockets_echo.py b/tests/websockets_echo.py index 19e791df..c3b50765 100644 --- a/tests/websockets_echo.py +++ b/tests/websockets_echo.py @@ -3,11 +3,11 @@ import uwsgi import time def application(env, sr): - + ws_scheme = 'ws' if 'HTTPS' in env or env['wsgi.url_scheme'] == 'https': ws_scheme = 'wss' - + if env['PATH_INFO'] == '/': sr('200 OK', [('Content-Type','text/html')]) return """ @@ -20,19 +20,19 @@ def application(env, sr): s.send("ciao"); }; s.onmessage = function(e) { - var bb = document.getElementById('blackboard') - var html = bb.innerHTML; - bb.innerHTML = html + '
' + e.data; + var bb = document.getElementById('blackboard') + var html = bb.innerHTML; + bb.innerHTML = html + '
' + e.data; }; - - s.onerror = function(e) { - alert(e); - } - - s.onclose = function(e) { - alert("connection closed"); - } - + + s.onerror = function(e) { + alert(e); + } + + s.onclose = function(e) { + alert("connection closed"); + } + function invia() { var value = document.getElementById('testo').value; s.send(value); @@ -43,13 +43,13 @@ def application(env, sr):

WebSocket

-
-
+
+
""" % (ws_scheme, env['HTTP_HOST']) elif env['PATH_INFO'] == '/foobar/': - uwsgi.websocket_handshake(env['HTTP_SEC_WEBSOCKET_KEY'], env.get('HTTP_ORIGIN', '')) + uwsgi.websocket_handshake(env['HTTP_SEC_WEBSOCKET_KEY'], env.get('HTTP_ORIGIN', '')) print "websockets..." while True: msg = uwsgi.websocket_recv()