Fixup hardcoded variables in websocket example.

This commit is contained in:
Paul J. Davis 2010-04-15 21:17:35 -04:00
parent bb2f51ccda
commit 898d770d14
2 changed files with 3 additions and 2 deletions

View File

@ -8,7 +8,7 @@ http://assorted.svn.sourceforge.net/viewvc/assorted/real-time-plotter/trunk/src/
<script>
window.onload = function() {
var data = {};
var s = new WebSocket("ws://nebula:8000/data");
var s = new WebSocket("ws://%(HTTP_HOST)s/data");
s.onopen = function() {
//alert('open');
s.send('hi');

View File

@ -8,7 +8,7 @@
import collections
import errno
from gunicorn.async.base import ALREADY_HANDLED
from gunicorn.workers.async import ALREADY_HANDLED
from eventlet import pools
import socket
import eventlet
@ -139,6 +139,7 @@ def app(environ, start_response):
data = open(os.path.join(
os.path.dirname(__file__),
'websocket.html')).read()
data = data % environ
start_response('200 OK', [('Content-Type', 'text/html'),
('Content-Length', len(data))])
return [data]