How can i implement continuous data streaming from backend with apigee?

I have a requirement to continuously stream data to the app like real-time stock quotes. I tried using node.js for this. I can stream the data one time, but I need it to be done continuously. I tried using sockets io as well and could call node script directly. What is the best way to do it through Apigee?

1 8 3,547
8 REPLIES 8

adas
New Member

@Nagashree B if you are looking for continuous data streaming between your backend and apigee, then "websockets" is probably what you want. WebSocket is a protocol providing full-duplex communications channels over a single TCP connection ideal for applications like stock tickers, multi-player games, chatroom applications etc. Apigee Edge doesn't have websockets support yet, but we are coming up with websockets support in our upcoming releases, which will make this use-case really simple to implement.

But till we announce the GA for websockets, you can use one of these options:

- node.js: set up a native node.js project in Apigee and you can use socket.io to create asynchronous connections to multiple targets.

- Java callout: If you have a "paid" version of Apigee Edge, you can use the java callout policy to write custom code to implement this behaviour

Hi @Nagashree B

Hope, your solution for streaming is going fine.

Just an update, WebSocket feature has been released as part of the latest Edge release.

Cheers, Rajesh

Hi Nagashree. I hope you were able to find a solution to your issue.

I'm having trouble streaming the response body of my backend api to the client via node.js in Apigee Edge. I read in your comment above and it seems that you were able to stream API responses from a stock API to a client via node.js.

Can you expound on how you were able to accomplish this? Any advice or code samples you can provide would be so very helpful. Thanks!

Best,

Chris

@Chris Covney

I am attaching a simple nodejs proxy with streaming enabled. See if this works for you. You can modify the URL to point to your streaming backend. Also let me know which version of Edge are you trying this on. Some of the older versions might have a bug which was fixed in the recent releases (cloud) and service packs (OPDK).

Hi Arghya,

I did not see any attachment. Perhaps you forgot to attach it? Thanks again!

Best,

Chris

I definitely added it and I could see it at the bottom of the page. I don't see it anymore though. Let me try to attach as part of the comments and not in reply to see if it helps.

Not applicable

@Chris Covney Can you see the attachment now ?

@arghya das

yes 🙂

thank you!

I'll let you know how this works out. I created a separate community post for this, so I'll provide updates there:

https://community.apigee.com/questions/8776/how-to-stream-an-api-response-body-to-client.html

Best, Chris