Socket automatically closes after 3 minutes


  • @admin

    request

    let { SmartAPI, WebSocket } = require("smartapi-javascript");
    
    let x = "";
    
    
    
    let web_socket = new WebSocket({
        client_code: "P529774",
        feed_token: "096281215"
    });
    
    web_socket.connect()
        .then(() => {
              web_socket.runScript("", "cn") 
              // SCRIPT: nse_cm|2885, mcx_fo|222900  TASK: mw|sfi|dp
            web_socket.runScript("nse_cm|2885", "mw");//reliance-eq
            web_socket.runScript("nse_cm|10999","mw"); //maruti-eq
                // setTimeout(function() {
                //     web_socket.close()
                // }, 10000)
        })
    
    web_socket.on('tick', receiveTick)
    
    
    function receiveTick(data) {
         console.log("ticks",data);
    }
    
    

    response

        bs: '29',
        ltt: '21/12/2021 13:12:16',
        tsq: '304666',
        v: '3910176',
        bp: '2334.90',
        cng: '57.65',
        bq: '180',
        ap: '2317.42',
        nc: '02.5315',
        name: 'sf',
        tbq: '1450051'
      }
    ]
    ticks [
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '7348.50',
        ltq: '1',
        tk: '10999',
        ltt: 'NA'
      },
      {
        to: '9061983549.92',
        lo: '2292.20',
        e: 'nse_cm',
        sp: '2335.00',
        c: '2277.35',
        ltp: '2334.80',
        ltq: '20',
        tk: '2885',
        bs: '29',
        ltt: '21/12/2021 13:12:16',
        tsq: '303855',
        v: '3910376',
        bp: '2334.80',
        cng: '57.45',
        bq: '311',
        ap: '2317.42',
        nc: '02.5227',
        name: 'sf',
        tbq: '1450851'
      }
    ]
    ticks [
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '2334.80',
        ltq: '20',
        tk: '2885',
        ltt: 'NA'
      },
      { tvalue: '21/12/2021 13:12:17', name: 
    'tm' }
    ]
    ticks [
      {
        to: '1714600777.52',
        lo: '7287.10',
        e: 'nse_cm',
        sp: '7348.50',
        c: '7286.60',
        ltp: '7348.50',
        ltq: '1',
        tk: '10999',
        bs: '1',
        ltt: '21/12/2021 13:12:17',
        tsq: '37102',
        v: '233326',
        bp: '7346.15',
        cng: '61.90',
        bq: '6',
        ap: '7348.52',
        nc: '00.8495',
        name: 'sf',
        tbq: '38393'
      }
    ]
    ticks [
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '7348.50',
        ltq: '1',
        tk: '10999',
        ltt: 'NA'
      },
      {
        to: '9061983549.92',
        lo: '2292.20',
        e: 'nse_cm',
        sp: '2335.00',
        c: '2277.35',
        ltp: '2334.80',
        ltq: '20',
        tk: '2885',
        bs: '29',
        ltt: '21/12/2021 13:12:16',
        tsq: '304605',
        v: '3910376',
        bp: '2334.80',
        cng: '57.45',
        bq: '313',
        ap: '2317.42',
        nc: '02.5227',
        name: 'sf',
        tbq: '1450853'
      }
    ]
    ticks [ { tvalue: '21/12/2021 13:12:18', 
    name: 'tm' } ]
    ticks [
      {
        to: '1714600777.52',
        lo: '7287.10',
        e: 'nse_cm',
        sp: '7348.50',
        c: '7286.60',
        ltp: '7348.50',
        ltq: '1',
        tk: '10999',
        bs: '1',
        ltt: '21/12/2021 13:12:17',
        tsq: '37129',
        v: '233326',
        bp: '7346.15',
        cng: '61.90',
        bq: '6',
        ap: '7348.52',
        nc: '00.8495',
        name: 'sf',
        tbq: '38384'
      }
    ]
    ticks [
      {
        to: '1714600777.52',
        lo: '7287.10',
        e: 'nse_cm',
        sp: '7348.50',
        c: '7286.60',
        ltp: '7348.50',
        ltq: '1',
        tk: '10999',
        bs: '1',
        ltt: '21/12/2021 13:12:17',
        tsq: '37128',
        v: '233326',
        bp: '7346.15',
        cng: '61.90',
        bq: '6',
        ap: '7348.52',
        nc: '00.8495',
        name: 'sf',
        tbq: '38390'
      },
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '2335.00',
        ltq: '21',
        tk: '2885',
        ltt: 'NA'
      }
    ]
    ticks [
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '2335.00',
        ltq: '1',
        tk: '2885',
        ltt: 'NA'
      },
      { tvalue: '21/12/2021 13:12:19', name: 
    'tm' }
    ]
    ticks [
      {
        to: '9062101738.34',
        lo: '2292.20',
        e: 'nse_cm',
        sp: '2335.00',
        c: '2277.35',
        ltp: '2335.00',
        ltq: '1',
        tk: '2885',
        bs: '178',
        ltt: '21/12/2021 13:12:18',
        tsq: '303920',
        v: '3910427',
        bp: '2334.80',
        cng: '57.65',
        bq: '313',
        ap: '2317.42',
        nc: '02.5315',
        name: 'sf',
        tbq: '1450823'
      }
    ]
    ticks [
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '7348.65',
        ltq: '1',
        tk: '10999',
        ltt: 'NA'
      }
    ]
    ticks [
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '7348.55',
        ltq: '1',
        tk: '10999',
        ltt: 'NA'
      }
    ]
    ticks [
      {
        to: '1714622823.08',
        lo: '7287.10',
        e: 'nse_cm',
        sp: '7349.00',
        c: '7286.60',
        ltp: '7348.55',
        ltq: '1',
        tk: '10999',
        bs: '12',
        ltt: '21/12/2021 13:12:19',
        tsq: '37196',
        v: '233329',
        bp: '7347.05',
        cng: '61.95',
        bq: '1',
        ap: '7348.52',
        nc: '00.8502',
        name: 'sf',
        tbq: '38444'
      }
    ]
    ticks [
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '2335.00',
        ltq: '93',
        tk: '2885',
        ltt: 'NA'
      },
      { tvalue: '21/12/2021 13:12:20', name: 
    'tm' }
    ]
    ticks [
      {
        to: '9062498017.16',
        lo: '2292.20',
        e: 'nse_cm',
        sp: '2334.95',
        c: '2277.35',
        ltp: '2335.00',
        ltq: '93',
        tk: '2885',
        bs: '10',
        ltt: '21/12/2021 13:12:19',
        tsq: '303293',
        v: '3910598',
        bp: '2334.80',
        cng: '57.65',
        bq: '318',
        ap: '2317.42',
        nc: '02.5315',
        name: 'sf',
        tbq: '1450860'
      }
    ]
    ticks [
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '2334.80',
        ltq: '190',
        tk: '2885',
        ltt: 'NA'
      },
      { tvalue: '21/12/2021 13:12:21', name: 
    'tm' },
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '7349.00',
        ltq: '1',
        tk: '10999',
        ltt: 'NA'
      }
    ]
    ticks [
      {
        to: '1714630171.60',
        lo: '7287.10',
        e: 'nse_cm',
        sp: '7349.00',
        c: '7286.60',
        ltp: '7349.00',
        ltq: '1',
        tk: '10999',
        bs: '11',
        ltt: '21/12/2021 13:12:20',
        tsq: '37195',
        v: '233330',
        bp: '7347.05',
        cng: '62.40',
        bq: '1',
        ap: '7348.52',
        nc: '00.8564',
        name: 'sf',
        tbq: '38442'
      }
    ]
    ticks [
      {
        to: '9063000897.30',
        lo: '2292.20',
        e: 'nse_cm',
        sp: '2334.95',
        c: '2277.35',
        ltp: '2334.95',
        ltq: '10',
        tk: '2885',
        bs: '8',
        ltt: '21/12/2021 13:12:21',
        tsq: '304100',
        v: '3910815',
        bp: '2334.80',
        cng: '57.60',
        bq: '120',
        ap: '2317.42',
        nc: '02.5293',
        name: 'sf',
        tbq: '1450691'
      }
    ]
    ticks [
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '2334.95',
        ltq: '10',
        tk: '2885',
        ltt: 'NA'
      }
    ]
    ticks [ { tvalue: '21/12/2021 13:12:22', 
    name: 'tm' } ]
    ticks [
      {
        to: '1714630171.60',
        lo: '7287.10',
        e: 'nse_cm',
        sp: '7349.00',
        c: '7286.60',
        ltp: '7349.00',
        ltq: '1',
        tk: '10999',
        bs: '11',
        ltt: '21/12/2021 13:12:20',
        tsq: '37195',
        v: '233330',
        bp: '7347.05',
        cng: '62.40',
        bq: '2',
        ap: '7348.52',
        nc: '00.8564',
        name: 'sf',
        tbq: '38443'
      }
    ]
    ticks [
      {
        to: '9063000897.30',
        lo: '2292.20',
        e: 'nse_cm',
        sp: '2334.95',
        c: '2277.35',
        ltp: '2334.95',
        ltq: '10',
        tk: '2885',
        bs: '8',
        ltt: '21/12/2021 13:12:21',
        tsq: '304878',
        v: '3910815',
        bp: '2334.80',
        cng: '57.60',
        bq: '120',
        ap: '2317.42',
        nc: '02.5293',
        name: 'sf',
        tbq: '1450691'
      }
    ]
    ticks [
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '2334.95',
        ltq: '5',
        tk: '2885',
        ltt: 'NA'
      }
    ]
    ticks [ { tvalue: '21/12/2021 13:12:23', 
    name: 'tm' } ]
    ticks [
      {
        to: '1714630171.60',
        lo: '7287.10',
        e: 'nse_cm',
        sp: '7349.00',
        c: '7286.60',
        ltp: '7349.00',
        ltq: '1',
        tk: '10999',
        bs: '11',
        ltt: '21/12/2021 13:12:20',
        tsq: '37194',
        v: '233330',
        bp: '7347.05',
        cng: '62.40',
        bq: '2',
        ap: '7348.52',
        nc: '00.8564',
        name: 'sf',
        tbq: '38484'
      }
    ]
    ticks [
      {
        to: '9063014801.82',
        lo: '2292.20',
        e: 'nse_cm',
        sp: '2334.95',
        c: '2277.35',
        ltp: '2334.80',
        ltq: '1',
        tk: '2885',
        bs: '3',
        ltt: '21/12/2021 13:12:23',
        tsq: '304125',
        v: '3910821',
        bp: '2334.80',
        cng: '57.45',
        bq: '124',
        ap: '2317.42',
        nc: '02.5227',
        name: 'sf',
        tbq: '1450695'
      }
    ]
    ticks [
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '7349.00',
        ltq: '11',
        tk: '10999',
        ltt: 'NA'
      }
    ]
    ticks [
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '2335.00',
        ltq: '100',
        tk: '2885',
        ltt: 'NA'
      }
    ]
    ticks [ { tvalue: '21/12/2021 13:12:24', 
    name: 'tm' } ]
    ticks [
      {
        to: '1714711005.32',
        lo: '7287.10',
        e: 'nse_cm',
        sp: '7349.40',
        c: '7286.60',
        ltp: '7349.00',
        ltq: '11',
        tk: '10999',
        bs: '59',
        ltt: '21/12/2021 13:12:23',
        tsq: '39473',
        v: '233341',
        bp: '7349.10',
        cng: '62.40',
        bq: '8',
        ap: '7348.52',
        nc: '00.8564',
        name: 'sf',
        tbq: '41165'
      }
    ]
    ticks [
      {
        to: '9064219860.22',
        lo: '2292.20',
        e: 'nse_cm',
        sp: '2335.00',
        c: '2277.35',
        ltp: '2334.80',
        ltq: '50',
        tk: '2885',
        bs: '324',
        ltt: '21/12/2021 13:12:24',
        tsq: '302227',
        v: '3911341',
        bp: '2334.80',
        cng: '57.45',
        bq: '74',
        ap: '2317.42',
        nc: '02.5227',
        name: 'sf',
        tbq: '1449655'
      }
    ]
    ticks [
      {
        to: '9064289382.82',
        lo: '2292.20',
        e: 'nse_cm',
        sp: '2335.00',
        c: '2277.35',
        ltp: '2335.00',
        ltq: '12',
        tk: '2885',
        bs: '307',
        ltt: '21/12/2021 13:12:24',
        tsq: '302686',
        v: '3911371',
        bp: '2334.80',
        cng: '57.65',
        bq: '74',
        ap: '2317.42',
        nc: '02.5315',
        name: 'sf',
        tbq: '1449655'
      }
    ]
    ticks [
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '2334.80',
        ltq: '9',
        tk: '2885',
        ltt: 'NA'
      }
    ]
    ticks [
      { tvalue: '21/12/2021 13:12:25', name: 
    'tm' },
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '7349.10',
        ltq: '20',
        tk: '10999',
        ltt: 'NA'
      }
    ]
    ticks [
      {
        to: '1714857975.72',
        lo: '7287.10',
        e: 'nse_cm',
        sp: '7349.40',
        c: '7286.60',
        ltp: '7349.10',
        ltq: '20',
        tk: '10999',
        bs: '59',
        ltt: '21/12/2021 13:12:24',
        tsq: '39511',
        v: '233361',
        bp: '7349.10',
        cng: '62.50',
        bq: '19',
        ap: '7348.52',
        nc: '00.8577',
        name: 'sf',
        tbq: '40768'
      }
    ]
    ticks [
      {
        to: '9064324144.12',
        lo: '2292.20',
        e: 'nse_cm',
        sp: '2335.00',
        c: '2277.35',
        ltp: '2334.80',
        ltq: '3',
        tk: '2885',
        bs: '304',
        ltt: '21/12/2021 13:12:25',
        tsq: '302712',
        v: '3911386',
        bp: '2334.80',
        cng: '57.45',
        bq: '118',
        ap: '2317.42',
        nc: '02.5227',
        name: 'sf',
        tbq: '1450495'
      }
    ]
    ticks [
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '2334.80',
        ltq: '3',
        tk: '2885',
        ltt: 'NA'
      },
      { tvalue: '21/12/2021 13:12:26', name: 
    'tm' },
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '7349.10',
        ltq: '5',
        tk: '10999',
        ltt: 'NA'
      }
    ]
    ticks [
      {
        to: '1714894718.32',
        lo: '7287.10',
        e: 'nse_cm',
        sp: '7349.40',
        c: '7286.60',
        ltp: '7349.10',
        ltq: '5',
        tk: '10999',
        bs: '59',
        ltt: '21/12/2021 13:12:25',
        tsq: '37098',
        v: '233366',
        bp: '7349.10',
        cng: '62.50',
        bq: '14',
        ap: '7348.52',
        nc: '00.8577',
        name: 'sf',
        tbq: '38477'
      }
    ]
    ticks [
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '2335.00',
        ltq: '6',
        tk: '2885',
        ltt: 'NA'
      },
      { tvalue: '21/12/2021 13:12:27', name: 
    'tm' }
    ]
    ticks [
      {
        to: '9064338048.64',
        lo: '2292.20',
        e: 'nse_cm',
        sp: '2335.00',
        c: '2277.35',
        ltp: '2335.00',
        ltq: '6',
        tk: '2885',
        bs: '298',
        ltt: '21/12/2021 13:12:26',
        tsq: '303517',
        v: '3911392',
        bp: '2334.80',
        cng: '57.65',
        bq: '124',
        ap: '2317.42',
        nc: '02.5315',
        name: 'sf',
        tbq: '1450698'
      }
    ]
    ticks [
      {
        to: '1714894718.32',
        lo: '7287.10',
        e: 'nse_cm',
        sp: '7349.40',
        c: '7286.60',
        ltp: '7349.10',
        ltq: '5',
        tk: '10999',
        bs: '59',
        ltt: '21/12/2021 13:12:25',
        tsq: '37098',
        v: '233366',
        bp: '7349.10',
        cng: '62.50',
        bq: '14',
        ap: '7348.52',
        nc: '00.8577',
        name: 'sf',
        tbq: '38779'
      }
    ]
    ticks [
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '2334.75',
        ltq: '14',
        tk: '2885',
        ltt: 'NA'
      },
      { tvalue: '21/12/2021 13:12:28', name: 
    'tm' }
    ]
    ticks [
      {
        to: '9064873092.58',
        lo: '2292.20',
        e: 'nse_cm',
        sp: '2335.00',
        c: '2277.35',
        ltp: '2334.75',
        ltq: '14',
        tk: '2885',
        bs: '304',
        ltt: '21/12/2021 13:12:27',
        tsq: '304487',
        v: '3911606',
        bp: '2334.75',
        cng: '57.40',
        bq: '5',
        ap: '2317.43',
        nc: '02.5205',
        name: 'sf',
        tbq: '1450594'
      }
    ]
    ticks [
      {
        to: '1714894718.32',
        lo: '7287.10',
        e: 'nse_cm',
        sp: '7349.40',
        c: '7286.60',
        ltp: '7349.10',
        ltq: '5',
        tk: '10999',
        bs: '59',
        ltt: '21/12/2021 13:12:25',
        tsq: '37098',
        v: '233366',
        bp: '7349.10',
        cng: '62.50',
        bq: '25',
        ap: '7348.52',
        nc: '00.8577',
        name: 'sf',
        tbq: '38861'
      }
    ]
    ticks [
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '2334.15',
        ltq: '64',
        tk: '2885',
        ltt: 'NA'
      },
      { tvalue: '21/12/2021 13:12:29', name: 
    'tm' },
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '7349.40',
        ltq: '1',
        tk: '10999',
        ltt: 'NA'
      }
    ]
    ticks [
      {
        to: '1714902066.84',
        lo: '7287.10',
        e: 'nse_cm',
        sp: '7349.40',
        c: '7286.60',
        ltp: '7349.40',
        ltq: '1',
        tk: '10999',
        bs: '58',
        ltt: '21/12/2021 13:12:28',
        tsq: '37117',
        v: '233367',
        bp: '7349.10',
        cng: '62.80',
        bq: '25',
        ap: '7348.52',
        nc: '00.8619',
        name: 'sf',
        tbq: '38560'
      }
    ]
    ticks [
      {
        to: '9065399149.19',
        lo: '2292.20',
        e: 'nse_cm',
        sp: '2334.80',
        c: '2277.35',
        ltp: '2334.15',
        ltq: '64',
        tk: '2885',
        bs: '102',
        ltt: '21/12/2021 13:12:28',
        tsq: '305927',
        v: '3911833',
        bp: '2334.75',
        cng: '56.80',
        bq: '12',
        ap: '2317.43',
        nc: '02.4941',
        name: 'sf',
        tbq: '1449945'
      }
    ]
    ticks [
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '2334.80',
        ltq: '81',
        tk: '2885',
        ltt: 'NA'
      },
      { tvalue: '21/12/2021 13:12:30', name: 
    'tm' }
    ]
    ticks [
      {
        to: '1714902066.84',
        lo: '7287.10',
        e: 'nse_cm',
        sp: '7349.40',
        c: '7286.60',
        ltp: '7349.40',
        ltq: '1',
        tk: '10999',
        bs: '58',
        ltt: '21/12/2021 13:12:28',
        tsq: '37139',
        v: '233367',
        bp: '7349.10',
        cng: '62.80',
        bq: '25',
        ap: '7348.52',
        nc: '00.8619',
        name: 'sf',
        tbq: '38565'
      }
    ]
    ticks [
      {
        to: '9065670288.50',
        lo: '2292.20',
        e: 'nse_cm',
        sp: '2334.80',
        c: '2277.35',
        ltp: '2334.75',
        ltq: '18',
        tk: '2885',
        bs: '19',
        ltt: '21/12/2021 13:12:30',
        tsq: '306874',
        v: '3911950',
        bp: '2334.75',
        cng: '57.40',
        bq: '55',
        ap: '2317.43',
        nc: '02.5205',
        name: 'sf',
        tbq: '1448797'
      }
    ]
    ticks [
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '2334.75',
        ltq: '39',
        tk: '2885',
        ltt: 'NA'
      },
      { tvalue: '21/12/2021 13:12:31', name: 
    'tm' }
    ]
    ticks [
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '7349.40',
        ltq: '1',
        tk: '10999',
        ltt: 'NA'
      },
      {
        to: '1714909415.36',
        lo: '7287.10',
        e: 'nse_cm',
        sp: '7349.40',
        c: '7286.60',
        ltp: '7349.40',
        ltq: '1',
        tk: '10999',
        bs: '57',
        ltt: '21/12/2021 13:12:30',
        tsq: '39538',
        v: '233368',
        bp: '7349.10',
        cng: '62.80',
        bq: '25',
        ap: '7348.52',
        nc: '00.8619',
        name: 'sf',
        tbq: '40964'
      }
    ]
    ticks [
      {
        to: '9065776890.28',
        lo: '2292.20',
        e: 'nse_cm',
        sp: '2334.80',
        c: '2277.35',
        ltp: '2334.80',
        ltq: '1',
        tk: '2885',
        bs: '12',
        ltt: '21/12/2021 13:12:31',
        tsq: '305313',
        v: '3911996',
        bp: '2334.75',
        cng: '57.45',
        bq: '16',
        ap: '2317.43',
        nc: '02.5227',
        name: 'sf',
        tbq: '1448915'
      }
    ]
    ticks [
      {
        e: 'nse_cm',
        name: 'sf',
        ltp: '2334.80',
        ltq: '1',
        tk: '2885',
        ltt: 'NA'
      },
      { tvalue: '21/12/2021 13:12:32', name: 
    'tm' }
    ]
    ticks [
      {
        to: '1714909415.36',
        lo: '7287.10',
        e: 'nse_cm',
        sp: '7349.40',
        c: '7286.60',
        ltp: '7349.40',
        ltq: '1',
        tk: '10999',
        bs: '57',
        ltt: '21/12/2021 13:12:30',
        tsq: '39538',
        v: '233368',
        bp: '7349.10',
        cng: '62.80',
        bq: '25',
        ap: '7348.52',
        nc: '00.8619',
        name: 'sf',
        tbq: '40964'
      }
    ]
    Socket closed
    
    
    
    

  • Hi @jety_22 our websocket is in beta mode we will update you on this.