Skip to main content

module for creating a http server which uses WebSockets

Project description

This module uses the network module to create a server, and implements http(s) and WebSockets over those connections. The most useful part of it is the RPC over WebSocket protocol. With only 6 lines of code you have a working system:

import websocketd

class Rpc:
    def __init__(self, remote):
        self.remote = remote

s = websocketd.RPChttpd(8000, Rpc)
websocketd.fgloop()

You only have to add what you want your server to do. Any connection to the server (in this case it listens on port 8000) causes an Rpc object to be instanced. Any calls made through that connection will cause method calls on that object. If the remote side supports the same protocol, calls can be made on it by calling methods on remote.

Please see example/server for more details on how to use this module.

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

websocket-httpd-0.5.tar.gz (34.1 kB view hashes)

Uploaded Source

Built Distribution

websocket_httpd-0.5-py3-none-any.whl (34.4 kB view hashes)

Uploaded Python 3

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