Skip to content

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

License

Notifications You must be signed in to change notification settings

nameko/nameko-bayeux-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

https://travis-ci.org/nameko/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.

The library is used by Nameko Salesforce which has been connected to a fairly busy production Salesforce account for over a year and proved robust.

Installation

Install from PyPI with pip:

pip install nameko-bayeux-client

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.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published