Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection Freezing After 30 Pings with No Error #236

Open
dawadam opened this issue Feb 29, 2024 · 0 comments
Open

Connection Freezing After 30 Pings with No Error #236

dawadam opened this issue Feb 29, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@dawadam
Copy link

dawadam commented Feb 29, 2024

Describe the bug
I am encountering an issue where the connection appears to freeze after 30 pings. There are no apparent errors or events logged during this process. This behavior persists consistently. I have attempted to troubleshoot the issue, but so far, I have been unable to identify the root cause. Any assistance or guidance on resolving this issue would be greatly appreciated.

To Reproduce

import TradingView from '@mathieuc/tradingview'


const client = new TradingView.Client(); // Creates a websocket client

// événements du client
client.onError((...err) => { // Listen for errors (can avoid crash)
    console.error('Client error:', ...err);
    // Do something...
});

client.onLogged((...args) => {
    console.error('Client logged:', ...args);
});

client.onPing((...args) => {
    console.error('Client ping:', ...args);
});

client.onData((...args) => {
    console.error('Client data:', ...args);
});

client.onEvent((...args) => {
    console.error('Client event:', ...args);
});


client.onConnected((...args) => {
    console.error('Client connected:', ...args);
});

client.onDisconnected((...args) => {
    console.error('Client disconnected:', ...args);
});


const chart = new client.Session.Chart(); // Init a Chart session

chart.setMarket('OANDA:EURUSD', { // Set the market
    timeframe: '1',
    type: 'HeikinAshi',
});

chart.onError((...err) => { // Listen for errors (can avoid crash)
    console.error('Chart error:', ...err);
    // Do something...
});

chart.onSymbolLoaded(() => { // When the symbol is successfully loaded
    console.log(`Market "${chart.infos.description}" loaded !`);
});

chart.onUpdate(() => { // When price changes
    if (!chart.periods[0]) return;
    // console.log(chart.infos)
    // console.log(chart.periods.length)
    console.log(`[${chart.infos.description}]: ${chart.periods[0].close} ${chart.infos.currency_id}`);
});

Expected behavior
No freezing

Screenshots
no

Environment:

  • OS: Linux
  • Node version: v20.10.0

Additional context
Last logs :

Client event: ping 28
[EUR/USD]: 1.080445 USD
[EUR/USD]: 1.080445 USD
[EUR/USD]: 1.0804412500000002 USD
[EUR/USD]: 1.0804412500000002 USD
Client ping: 29
Client event: ping 29
[EUR/USD]: 1.0804375000000002 USD
[EUR/USD]: 1.0804375000000002 USD
[EUR/USD]: 1.0804387500000001 USD
[EUR/USD]: 1.0804387500000001 USD
Client ping: 30
Client event: ping 30
[EUR/USD]: 1.08044 USD
[EUR/USD]: 1.08044 USD
[EUR/USD]: 1.0804387500000001 USD
[EUR/USD]: 1.0804387500000001 USD
@dawadam dawadam added the bug Something isn't working label Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants