from flask import Flask, render_template from flask_sockets import Sockets app = Flask(__name__) sockets = Sockets(app) @sockets.route('/echo') def echo_socket(ws): while True: message = ws.receive() ws.send(message) @app.route('/') def hello(): return render_template('hello.html') if __name__ == '__main__': app.run() <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</