Find file
Fetching contributors…
Cannot retrieve contributors at this time
21 lines (15 sloc) 394 Bytes
import json
from flask import Flask, request, render_template
app = Flask(__name__)
app.debug = True
@app.route('/')
def index():
return render_template('index.html')
@app.route('/api')
def api():
if request.environ.get('wsgi.websocket'):
ws = request.environ['wsgi.websocket']
while True:
message = ws.receive()
ws.send(message)
return