Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added simple AsyncIO example. #188

Merged
merged 3 commits into from
Jul 30, 2024
Merged

added simple AsyncIO example. #188

merged 3 commits into from
Jul 30, 2024

Conversation

stephenlb
Copy link
Member

AsyncIO PubNub Subscribe Example

pubnub-asyncio-simple-example

Usage example:

pip install asyncio pubnub
export PUBNUB_PUBLISH_KEY=demo
export PUBNUB_SUBSCRIBE_KEY=demo
python main.py

Output:

Listening for messages...
Connected
Received message: Hello World on channel: my_channel
Received message: Hello World on channel: my_channel
Received message: Hello World on channel: my_channel
Received message: Hello World on channel: my_channel
Received message: Hello World on channel: my_channel

In another terminal:

export PUBNUB_PUBLISH_KEY=demo
export PUBNUB_SUBSCRIBE_KEY=demo
curl "https://ps.pndsn.com/publish/${PUBNUB_PUBLISH_KEY}/${PUBNUB_SUBSCRIBE_KEY}/0/my_channel/0/%22Hello%20World%22"

Output:

[1,"Sent","17183967137027574"]

Copy link
Contributor

@seba-aln seba-aln left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the example @stephenlb

@seba-aln seba-aln force-pushed the simple-asyncio-example branch from 6da272b to e33490f Compare July 29, 2024 20:55
@seba-aln seba-aln merged commit e5416cf into master Jul 30, 2024
18 checks passed
@seba-aln seba-aln deleted the simple-asyncio-example branch July 30, 2024 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants