miguelgrinberg / flask-sock

Modern WebSocket support for Flask.
MIT License
271 stars 24 forks source link

dynamic add_url_rule alternative to @route decorator? #65

Closed snarfed closed 12 months ago

snarfed commented 12 months ago

Hi! First off, thank you for building and maintaining flask-sock, and for all your other websocket work. It's great!

I'm adding websockets to a Flask app that needs to register its routes dynamically. I'm using Flask.add_url to do this for normal HTTP handlers, which works fine, but it looks like flask-sock currently only has the @route decorator. Any thoughts on how I could register routes dynamically with flask-sock?

Thanks in advance!

snarfed commented 12 months ago

Ah, looks like I can just call the decorator manually, eg sock.route('/path')(fn). OK! Might be worth adding to the docs, low priority.