Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs

    socket closed after few minutes

    Bugs
    3
    3
    35
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sumeet1990 last edited by

      Re: Socket closed

      @admin: can you please check for socket closing issue, I am using nodejs for socket connection

      A J 2 Replies Last reply Reply Quote 0
      • A
        admin @sumeet1990 last edited by

        HI @sumeet1990 Currently our team is working on websocket we will get back to you once we have an update.

        1 Reply Last reply Reply Quote 0
        • J
          jety_22 @sumeet1990 last edited by

          @sumeet1990
          I am getting this error can you help me ?

          d:\home page\smart api\test.js:22
          web_socket.connect()
          ^
          
          ReferenceError: web_socket is not defined
             at Object.<anonymous> (d:\home page\smart api\test.js:22:1)
             at Module._compile (node:internal/modules/cjs/loader:1101:14)
             at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
             at Module.load (node:internal/modules/cjs/loader:981:32)
             at Function.Module._load (node:internal/modules/cjs/loader:822:12)
             at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
             at node:internal/main/run_main_module:17:47
          

          This is the code

          let { SmartAPI, WebSocket } = require("smartapi-javascript");
          
          
          
          // ########################### Socket Sample Code Starts Here ###########################
          // Old Websocket
          // let { ws } = require("websocket");
          web_socket.connect()
              .then(() => {
                  var ACTION_TYPE = "subscribe";
                  var FEED_TYPE = "order_feed";
                  console.log("Connected to Web Socket");
                  web_socket.fetchData(subscribe, order_feed); // ACTION_TYPE: subscribe | unsubscribe FEED_TYPE: order_feed
          
                  setTimeout(function() {
                      web_socket.close()
                  }, 60000)
              });
          
          web_socket.on('tick', receiveTick);
          
          
          function receiveTick(data) {
              console.log("receiveTick:::::", data);
          }
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post