Example for Bayeux protocol for long-polling streaming api


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