Welcome to aio-sf-streaming’s documentation!

Last release Build MIT license

aio-sf-streaming is a simple Python 3.6 asyncio library allowing to connect and receive live notifications from Salesforce. This library is provided to you by papernest.

See The Force.com streaming API developer guide for more information about the different uses cases and how configure your Salesforce organization.

Simple example

import asyncio
from aio_sf_streaming import SimpleSalesforceStreaming

async def print_event():
    # Create client and connect
    async with SimpleSalesforceStreaming(
                    client_secret='my-client-secret') as client:
        # Subscribe to some push topics
        await client.subscribe('/topic/Foo')
        await client.subscribe('/topic/Bar')
        # Print received message infinitely
        async for message in client.events():
            channel = message['channel']
            print(f"Message received on {channel} : {message}")

loop = asyncio.get_event_loop()

Main features

  • asyncio compatible library

  • Authentication with username/password or refresh token

  • Subscribe to push topics and custom events

  • Receive events pushed by Salesforce

  • Auto-reconnect after too many time of inactivity

  • Replay support: replay events missed while your client is disconnected (see Force.com documentation for more information).

aio-sf-streaming only support Python 3.6 for now.