Skip to main content

Asynchronous WSGI and WebSocket server based on asyncore module

Project description

This is a single-threaded asynchronous WSGI server with WebSockets support based on asyncore module. It should be compatible with Python 2.7 and 3.

Example:

from from wsgiref.simple_server import demo_app
from asyncore_wsgi import AsyncWebSocketHandler, make_server


class SimpleEchoHandler(AsyncWebSocketHandler):

    def handleMessage(self):
        print('Received WebSocket message: {}'.format(self.data))
        self.sendMessage(self.data)

    def handleConnected(self):
        print('WebSocket connected')

    def handleClose(self):
        print('WebSocket closed')


httpd = make_server('', 8000, demo_app, ws_handler_class=SimpleEchoHandler)
httpd.serve_forever()

The server in the preceding example serves a demo WSGI app from the Standard Library and the echo WebSocket handler on '/ws' path.

WebSocket part was borrowed from this project.

License

MIT, see LICENSE.txt

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asyncore-wsgi-0.0.11.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

asyncore_wsgi-0.0.11-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file asyncore-wsgi-0.0.11.tar.gz.

File metadata

  • Download URL: asyncore-wsgi-0.0.11.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for asyncore-wsgi-0.0.11.tar.gz
Algorithm Hash digest
SHA256 5a8f999715ac4222c7a3d4cfa427535ac2dc9adf7e18d1c7e511924864133e16
MD5 be552f7fceb60759e7d43126924b1723
BLAKE2b-256 baeee89c43a89ca46fb71875a9ecc854e52d8767696489bce2cf7beade376c07

See more details on using hashes here.

File details

Details for the file asyncore_wsgi-0.0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for asyncore_wsgi-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 16cc499992d23adf3ad27f5e9a226c3212e78490aab6ea92d9167f2f1acbd6f1
MD5 b6b72d675df9579ca494da87d8667928
BLAKE2b-256 8283ac56a2f11d43a20d78eddd0bf77138dd2a14279151ee3da6c84677ed9e0d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page