☰
Login
Signup
Home
›
Market data (WebSockets)
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Register
Categories
Recent Discussions
Activity
Categories
14.9K
All Categories
0
Incidents
177
Node JS client
51
Go client
841
.Net API client
397
Kite Publisher
554
.Net / VBA / Excel (3rd party)
490
Algorithms and Strategies
1.1K
Java client
1.2K
API clients
409
PHP client
4.3K
Python client
357
Mobile and Desktop apps
1.5K
Market data (WebSockets)
3.6K
General
In this Discussion
January 2025
sujith
January 2025
avnikk
AggregateError in Websocket
avnikk
January 2025
in
Market data (WebSockets)
type: 'error',
message: '',
error: AggregateError [EHOSTUNREACH]:
at internalConnectMultiple (node:net:1139:18)
at afterConnectMultiple (node:net:1712:7) {
code: 'EHOSTUNREACH',
[errors]: [ [Error], [Error] ]
}
}
avnikk
January 2025
i am trying to connect it, but it keeps getting disconnected after few mins
avnikk
January 2025
@sujith
avnikk
January 2025
@rakeshr
avnikk
January 2025
if i send any invalid or null token, or null value to socket will it close the socket??
avnikk
January 2025
edited January 2025
please let me know if code needed of execution
avnikk
January 2025
update : it is still getting disconnected
avnikk
January 2025
WebSocket error: ErrorEvent {
10|Zerodha | target: WebSocket {
10|Zerodha | _events: [Object: null prototype] {
10|Zerodha | open: [Function],
10|Zerodha | message: [Function],
10|Zerodha | error: [Function],
10|Zerodha | close: [Function]
10|Zerodha | },
10|Zerodha | _eventsCount: 4,
10|Zerodha | _maxListeners: undefined,
10|Zerodha | readyState: 2,
10|Zerodha | protocol: '',
10|Zerodha | _binaryType: 'arraybuffer',
10|Zerodha | _closeFrameReceived: false,
10|Zerodha | _closeFrameSent: false,
10|Zerodha | _closeMessage: '',
10|Zerodha | _closeTimer: null,
10|Zerodha | _closeCode: 1006,
10|Zerodha | _extensions: {},
10|Zerodha | _receiver: null,
10|Zerodha | _sender: null,
10|Zerodha | _socket: null,
10|Zerodha | _isServer: false,
10|Zerodha | _redirects: 0,
10|Zerodha | url: 'wss://ws.kite.trade/?api_key=&access_token=&uid=',
10|Zerodha | _req: null,
10|Zerodha | [Symbol(shapeMode)]: false,
10|Zerodha | [Symbol(kCapture)]: false
10|Zerodha | },
10|Zerodha | type: 'error',
10|Zerodha | message: '',
10|Zerodha | error: AggregateError [EHOSTUNREACH]:
10|Zerodha | at internalConnectMultiple (node:net:1139:18)
10|Zerodha | at afterConnectMultiple (node:net:1712:7) {
10|Zerodha | code: 'EHOSTUNREACH',
10|Zerodha | [errors]: [ [Error], [Error] ]
10|Zerodha | }
10|Zerodha | }
sujith
January 2025
Make sure you are not blocking the thread on which you are receiving ticks.
avnikk
January 2025
would this work?
function onTicks(data1) {
try {
if (!Array.isArray(data1)) return;
data1.forEach(data => {
if (!data || data.mode !== 'full') {
return;
}
// Offload the publish operation to a later iteration of the event loop
setImmediate(() => {
redisPublisher.publish('DataSender', JSON.stringify(data));
});
});
} catch (error) {
console.error(`Error processing message: ${error}`);
}
}
avnikk
January 2025
@sujith
avnikk
January 2025
did not work sujith, it is still keeps getting disconnect works for few mins then stops working, keeps diconnecting
avnikk
January 2025
can u please be quick or connect or call or email, it is causing lot of issue to me any help would be really greatfull
avnikk
January 2025
@sujith
sujith
January 2025
You shouldn't do anything inside onTicks, offload everything to a secondary thread.
PS: For testing remove everything there.
avnikk
January 2025
okay
@sujith
can u help by second thread do i have to make and pass it to another function or do i need to use worker thread to do so?
avnikk
January 2025
and
@sujith
what causes this AggregateError?
sujith
January 2025
In JavaScript, you need to use async method.
You can read about AggregateError
here
.
Sign In
or
Register
to comment.
10|Zerodha | target: WebSocket {
10|Zerodha | _events: [Object: null prototype] {
10|Zerodha | open: [Function],
10|Zerodha | message: [Function],
10|Zerodha | error: [Function],
10|Zerodha | close: [Function]
10|Zerodha | },
10|Zerodha | _eventsCount: 4,
10|Zerodha | _maxListeners: undefined,
10|Zerodha | readyState: 2,
10|Zerodha | protocol: '',
10|Zerodha | _binaryType: 'arraybuffer',
10|Zerodha | _closeFrameReceived: false,
10|Zerodha | _closeFrameSent: false,
10|Zerodha | _closeMessage: '',
10|Zerodha | _closeTimer: null,
10|Zerodha | _closeCode: 1006,
10|Zerodha | _extensions: {},
10|Zerodha | _receiver: null,
10|Zerodha | _sender: null,
10|Zerodha | _socket: null,
10|Zerodha | _isServer: false,
10|Zerodha | _redirects: 0,
10|Zerodha | url: 'wss://ws.kite.trade/?api_key=&access_token=&uid=',
10|Zerodha | _req: null,
10|Zerodha | [Symbol(shapeMode)]: false,
10|Zerodha | [Symbol(kCapture)]: false
10|Zerodha | },
10|Zerodha | type: 'error',
10|Zerodha | message: '',
10|Zerodha | error: AggregateError [EHOSTUNREACH]:
10|Zerodha | at internalConnectMultiple (node:net:1139:18)
10|Zerodha | at afterConnectMultiple (node:net:1712:7) {
10|Zerodha | code: 'EHOSTUNREACH',
10|Zerodha | [errors]: [ [Error], [Error] ]
10|Zerodha | }
10|Zerodha | }
function onTicks(data1) {
try {
if (!Array.isArray(data1)) return;
data1.forEach(data => {
if (!data || data.mode !== 'full') {
return;
}
// Offload the publish operation to a later iteration of the event loop
setImmediate(() => {
redisPublisher.publish('DataSender', JSON.stringify(data));
});
});
} catch (error) {
console.error(`Error processing message: ${error}`);
}
}
PS: For testing remove everything there.
You can read about AggregateError here.