Portfolio Websocket connection throwing error, unable to connect

error getaddrinfo ENOTFOUND wsportfolioupdate-api.upstox.com

Seeing this error on console while trying to connect

We are using this approach : Streamer Functions | Upstox Developer API

Edit : Created a ticket for this - Ticket ID: 9751875

1 Like

@Rajesh_51191072 Which programming language you are using? Also the link from where you have downloaded the SDK. Official link for portfolio stream is different as mentioned here in the official code - upstox-nodejs/src/feeder/PortfolioDataFeeder.js at master Ā· upstox/upstox-nodejs Ā· GitHub

@DSingh I’m using NodeJS. SDK being used is the latest one available on ā€˜npm’ . Also, I’m not invoking any URL manually, it might be getting called internally by the SDK. Attaching a sample of the code here:

const UpstoxClient = require(ā€œupstox-js-sdkā€);

/** Current portfolio streamer instance for disconnect. */
let currentStreamer = null;

/**

Connect to Upstox Portfolio WebSocket for real-time order (and optional position/holding/GTT) updates.

@see https://upstox.com/developer/api-documentation/streamer-function#portfoliodatastreamer
*/
export async function connectPortfolioDataStream() {
const accessToken = readAccessToken();

const defaultClient = UpstoxClient.ApiClient.instance;
const OAUTH2 = defaultClient.authentications[ā€œOAUTH2ā€];
OAUTH2.accessToken = accessToken;

const streamer = new UpstoxClient.PortfolioDataStreamer();
currentStreamer = streamer;
streamer.connect();

streamer.on(ā€œopenā€, () => {
console.log(ā€œPortfolio WebSocket: openā€);
});

streamer.on(ā€œmessageā€, (data) => {
const feed = data.toString(ā€œutf-8ā€);
console.log(ā€œPortfolio WebSocket: messageā€ + feed);
});

streamer.on(ā€œerrorā€, (err) => {
console.error(ā€œPortfolio WebSocket: errorā€, err?.message || err);
});

streamer.on(ā€œcloseā€, () => {
console.log(ā€œPortfolio WebSocket: closeā€);
if (currentStreamer === streamer) currentStreamer = null;
});

return streamer;
}

Note : This example is very similar to the one quoted on your official documentation here

Also, from the error, it doesn’t seem to be an issue with the code or SDK, rather, the DNS name is not being resolved anymore.

Did you guys accidentally bring down that endpoint (wsportfolioupdate-api.upstox.com), yet still unaware about it ?

PS: This was working perfectly up untill today afternoon. I have been using this SDK for the past 1 week without any issues.

Attaching screenshot of Postman - tried connecting to the URL you mentioned , same error. @DSingh

@Ketan_Gupta Kindly check.

Same happening for me, it has stopped working some time around afternoon. The ELB is down.

Please fix this issue ASAP, our system we have developed locally relies on that portfolio stream socket.

1 Like

Hi @Rajesh_51191072 @DSingh @SHAIK_43162122
This issue has been resolved, can you please check and confirm.

Thanks!

1 Like

Yes, it has been fixed now. Thanks.

1 Like

I also have a similar issue with my Market Data Feed Websocket , where i get a 403 when i try from my IP 65.20.75.231