Home > Back-end >  Is there a way to process http request in websockets?
Is there a way to process http request in websockets?

Time:10-11

I want to allow python websockets module to process HTTP request and not only WebSocket formatted requests.

Or i need to write custom http server?

CodePudding user response:

The websockets package was not designed for this. From the docs:

Why shouldn’t I use websockets?

[...]

  • If you’re looking for a mixed HTTP / WebSocket library [...]

    If you want to do both in the same server, look at HTTP frameworks that build on top of websockets to support WebSocket connections, like Sanic.

This answer is not an endorsement/recommendation of Sanic; that's just one example which was copied from the websockets doc.

  • Related