You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
289 B
Python
17 lines
289 B
Python
2 years ago
|
from flask import Flask, render_template
|
||
|
from flask_sock import Sock
|
||
|
|
||
|
app = Flask(__name__)
|
||
|
sock = Sock(app)
|
||
|
|
||
|
|
||
|
@app.route('/')
|
||
|
def index():
|
||
|
return render_template('index.html')
|
||
|
|
||
|
|
||
|
@sock.route('/echo')
|
||
|
def echo(sock):
|
||
|
while True:
|
||
|
data = sock.receive()
|
||
|
sock.send(data)
|