Add python dependencies and websocket echo server
This commit is contained in:
parent
82d0ce29af
commit
573fac40cc
2
glebby-server/.gitignore
vendored
Normal file
2
glebby-server/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
venv
|
||||
__pycache__
|
16
glebby-server/glebby.py
Normal file
16
glebby-server/glebby.py
Normal file
@ -0,0 +1,16 @@
|
||||
from flask import Flask, render_template
|
||||
from flask_sock import Sock
|
||||
import simple_websocket
|
||||
|
||||
app = Flask(__name__)
|
||||
sock = Sock(app)
|
||||
|
||||
@sock.route('/echo')
|
||||
def echo(sock):
|
||||
print('New echo client')
|
||||
try:
|
||||
while True:
|
||||
data = sock.receive()
|
||||
sock.send(data)
|
||||
except simple_websocket.ConnectionClosed:
|
||||
print("Client closed the connection")
|
12
glebby-server/requirements.txt
Normal file
12
glebby-server/requirements.txt
Normal file
@ -0,0 +1,12 @@
|
||||
click==8.1.3
|
||||
Flask==2.2.2
|
||||
flask-sock==0.6.0
|
||||
h11==0.14.0
|
||||
importlib-metadata==6.0.0
|
||||
itsdangerous==2.1.2
|
||||
Jinja2==3.1.2
|
||||
MarkupSafe==2.1.1
|
||||
simple-websocket==0.9.0
|
||||
Werkzeug==2.2.2
|
||||
wsproto==1.2.0
|
||||
zipp==3.11.0
|
Loading…
x
Reference in New Issue
Block a user