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.3.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asyncore_wsgi-0.0.3-py2.py3-none-any.whl (10.6 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: asyncore-wsgi-0.0.3.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for asyncore-wsgi-0.0.3.tar.gz
Algorithm Hash digest
SHA256 9a0abd1a9cb032bf47b22c420968b8408b2dc0ab4d37c45b23930b4f16b98142
MD5 62b815df3fbec438879c3d2105f553a3
BLAKE2b-256 12ad7a50c0760e05c9fd6ff215970bceab9c53997cac7d2481483eb803d2d231

See more details on using hashes here.

File details

Details for the file asyncore_wsgi-0.0.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for asyncore_wsgi-0.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b1f5829daafff2983c4dbf7ed753b7f7c5ae649516597c8b478adf472052cbcd
MD5 19653d44d894ae82a5b35e1535533360
BLAKE2b-256 7c5d0aad821789af0c737a0483331191ad348b08fc6d9e44e00098d2798009d4

See more details on using hashes here.

Supported by

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