Skip to content

Instantly share code, notes, and snippets.

@stephenlb
Last active July 8, 2021 18:19
Show Gist options
  • Save stephenlb/a1e7afd42f82e2de708d to your computer and use it in GitHub Desktop.
Save stephenlb/a1e7afd42f82e2de708d to your computer and use it in GitHub Desktop.
Bash and Shell Command PubNub Subscribe in One Line - Basic TCP Subscribe Calls
## =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
## URL Variables
## http://p.pubnub.com/stream/<SUBKEY>/<CHANNEL>/0/-1
## =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
## Demo Stream
while true; do (printf 'GET http://p.pubnub.com/stream/sub-c-5f1b7c8e-fbee-11e3-aa40-02ee2ddab7fe/pubnub-sensor-network/0/-1 HTTP/1.1\r\nHost: pubnub\r\n\r\n'; sleep 5) | nc p.pubnub.com 80; done
## Local tunnel
curl "http://0.0.0.0:80/publish/demo-36/demo-36/0/ch6/0/1"
while true; do (printf 'GET /stream/demo-36/ch6/0/-1 HTTP/1.1\r\nHost: pubnub\r\n\r\n'; sleep 10) | nc 0.0.0.0 80; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment