One of the benefits of class based views is easily applying logic (e.g., authentication validation) globally across all endpoints.
Is that possible with flask-sock? The following doesn't work for me - 404 not found:
import time
from flask import Flask
from flask.views import View
from flask_sock import Sock
app = Flask(__name__)
sock = Sock(app)
class RobotsView(View):
@sock.route("/ws/robots")
def greet(ws):
while True:
ws.send("hello")
time.sleep(2)
However, I can connect to the endpoint no problem if I don't wrap the function in a class.
One of the benefits of class based views is easily applying logic (e.g., authentication validation) globally across all endpoints.
Is that possible with flask-sock? The following doesn't work for me - 404 not found:
However, I can connect to the endpoint no problem if I don't wrap the function in a class.