# Example for Bayeux protocol for long-polling streaming api

**URL:** https://discourse.nodered.org/t/example-for-bayeux-protocol-for-long-polling-streaming-api/4873
**Category:** Developing Nodes
**Created:** [14 November 2018 16:06 UTC](https://discourse.nodered.org/t/example-for-bayeux-protocol-for-long-polling-streaming-api/4873 "2018-11-14T16:06:43Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![rladd](https://avatars.discourse-cdn.com/v4/letter/r/ecd19e/32.png) [@rladd](https://discourse.nodered.org/u/rladd)
#### Post date: [14 November 2018 16:06 UTC](https://discourse.nodered.org/t/example-for-bayeux-protocol-for-long-polling-streaming-api/4873/1 "2018-11-14T16:06:43Z")

</div>

I'm wondering if there are any good examples on making a custom node to handle subscribing to a realtime api channel. What happens is this:

- first you send a post request with your user/pass authentication to a handshake channel
- the api server responds with a unique client ID
- you then can subscribe to different long-polling channels with a post request using this client id
- the server will hold the request until information is available and the client then immediately sends a re-request
- in case of server timeouts the client connects again and starts over

The goal of my node is to simplify this workflow into a node that takes the channel you want to sub to and your user/pass and then will sit there and sub to the long-polling channel. Are there any good examples of a handshake -\> sub node already? Thanks
