Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

added simple AsyncIO example.#188

Merged
seba-aln merged 3 commits intomasterpubnub/python:masterfrom
simple-asyncio-examplepubnub/python:simple-asyncio-exampleCopy head branch name to clipboard
Jul 30, 2024
Merged

added simple AsyncIO example.#188
seba-aln merged 3 commits intomasterpubnub/python:masterfrom
simple-asyncio-examplepubnub/python:simple-asyncio-exampleCopy head branch name to clipboard

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

@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
@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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.