heroku-python / flask-sockets

[DEPRECATED] Alternative: https://github.com/miguelgrinberg/flask-sock
MIT License
1.74k stars 164 forks source link

add werkzeug routing: allows '/endpoint/<some_id>' style routing #18

Closed jolleon closed 8 years ago

jolleon commented 10 years ago

This adds support for variable url paths just like with Flask's app.route decorator, so you can now do things like:

@sockets.route('/submit/<game_id>')
def submit(ws, game_id):
    ...

I hadn't seen pull requests #7 and #14 before I wrote this, this is essentially the same thing but done differently (and with less changes) so maybe you'll like this better? I used werkzeug since this is what Flask is using. This works fine for me although I only tested it in the context of my project. If you think this doesn't make sense I'm happy to take suggestions and improve it, seems like this is a feature a lot of people want.

codebynumbers commented 10 years ago

Works practically right out of the box without need to mess with LocalProxy, on a modified version of https://github.com/heroku-examples/python-websockets-chat

kennethreitz commented 10 years ago

Love it! Can you perform a rebase so I can merge? :)

jolleon commented 10 years ago

I just rebased but I don't know if that's supposed to show up here... let me know if I need to do something else!

shanet commented 10 years ago

Any chance of still getting this merged?

urbaniak commented 9 years ago

:+1:

I'm also interested in seeing that merged it.

kekssw commented 9 years ago

Any chance of getting this released any time soon?

philipn commented 9 years ago

The above is working great for me, especially in tandem with the other PRs here. BTW, @kennethreitz (or anyone else who wants an updated package), I've merged all the outstanding PRs together in my master over here: https://github.com/philipn/flask-sockets

kennethreitz commented 8 years ago

:sparkles: :cake: :sparkles:

kennethreitz commented 8 years ago

Sorry for the long delay on this — I'm really excited about it :)