Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

asyncore-wsgi

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asyncore-wsgi

Asynchronous WSGI and WebSocket server based on asyncore module

  • 0.0.11
  • PyPI
  • Socket score

Maintainers
1

asyncore-wsgi

This is a single-threaded asynchronous WSGI server with WebSockets support based on asyncore <https://docs.python.org/3.6/library/asyncore.html>_ module. It should be compatible with Python 2.7 and 3.

Example:

.. code-block:: python

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 <https://github.com/dpallot/simple-websocket-server>_.

License

MIT, see LICENSE.txt

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc