1

I'm trying to figure out the best architecture to support connections to thousands of websockets alongside a managing HTTP server.

I want to be able to manage all of the connections through the HTTP server with minimum complexity.

Ideally, I am trying to merge:

  • An existing proprietary python library that uses the websockets package
  • A connexion (Flask-OpenAPI) application framework

Can these parts fit together?

Also, could this run under a WSGI server gracefully or must I transition to ASGI?

Any assistance, tips or pointers would be much appreciated. Thanks

1 Answers1

0

Have you tried using threading where you can run multiple things at once. To start a thread it's simple just

from threading import Thread

def testT1():
    for x in range(20):
        print("printing from testT1")

def testT2():
    for x in range(20):
        print("printing from testT2")

Thread(target=testT1).start()
Thread(target=testT2).start()

This might not be the best example. But basically it allows to run multiple things even if testT1 blocks it

Damien
  • 61
  • 5