Skip to main content

Nameko extension with a Cometd client implementing Bayeux protocol

Project description

https://travis-ci.org/Overseas-Student-Living/nameko-bayeux-client.svg?branch=master

Nameko Cometd Bayeux Client

Nameko extension with a Cometd client implementing Bayeux protocol supporting server to client event delivery via long-polling HTTP transport.

Usage

Add Bayeux client configuration to your Nameko config file:

# config.yaml

BAYEUX:
    VERSION: 1.0
    MINIMUM_VERSION: 1.0
    SERVER_URI: http://example.com/cometd

Decorate entrypoint in your service class:

# service.py

from nameko_bayeux_client import subscribe

class Service:

    name = 'some-service'

    @subscribe('/some/topic')
    def handle_event(self, data):
        # this entrypoint is fired on incoming events
        # of '/some/topic' channel
        print(data)

Run your service, providing the config file:

$ nameko run service --config config.yaml

On start-up, the extension connects to Cometd server, subscribes and starts listening to channels defined by entrypoints.

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

nameko-bayeux-client-0.0.1.tar.gz (5.7 kB view hashes)

Uploaded Source

Built Distribution

nameko_bayeux_client-0.0.1-py3-none-any.whl (8.0 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