Results 1 to 7 of 7

Thread: Can someone help convert this nodejs code

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2020
    Posts
    6

    Can someone help convert this nodejs code

    This is in the documentation to connect with socket data in nodejs

    And I am not good at api programming

    Code:
    var request = require("request");
     var socketIoClient = require("socket.io-client");
     let userID = "user1";
     let password = "Abc@123";
     let publicKey = "f5c57c8071b08536";
     let publishFormat = "JSON";
     let broadcastFormat = "Full";
     let url = "http://192.168.1.163:3000";
     var data = {
           "userID": "user-id",
         "password": "your-password",
         "publicKey": "your-public-key",
         "source": "WEB"
     };
     request.post({
         url: url + "/auth/login",
         json: true,
         headers: {
               'Content-Type': 'application/json',
               'Content-Length': data.length
         },
         body: data
     }, function (err, res, body) {
         if (body.type == "success") {
               if (body.result.token) {
                     var token = body.result.token;
                     var socket = socketIoClient(url, {
                         path: '/marketdata/socket.io',
                         query: {
                               token: "token",
                               userID: "userID",
                               source: "WEB",
                               publishFormat: "JSON",
                               broadcastMode: "Full"
                         }
                   });
                 socket.on('connect', function () {});
             } else {
               console.log(body.description);
         }
     });
    Can someone help me convert this into vb.net please....
    Last edited by dday9; Sep 15th, 2020 at 08:54 AM.

  2. #2

    Thread Starter
    New Member
    Join Date
    Aug 2020
    Posts
    6

    Re: Please help with socket api,,,

    Hey can anyone help a newbie here

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2020
    Posts
    6

    Re: Can someone help convert this nodejs code

    Guyz I just need to convert these query parameters to connect to the socket.io,, i have been trying and it says invalid json format,,,

    For generating token the first half I was successfully able to generate token using post but unable to connect to socket

  4. #4
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    3,048

    Re: Can someone help convert this nodejs code

    Quote Originally Posted by varun432 View Post
    Guyz I just need to convert these query parameters to connect to the socket.io,, i have been trying and it says invalid json format,,,
    well you answered you own question ...
    and it says invalid json format,,,
    so how are we supposed to correct the Json?
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  5. #5
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,543

    Re: Can someone help convert this nodejs code

    Quote Originally Posted by varun432 View Post
    This is in the documentation to connect with socket data in nodejs

    And I am not good at api programming

    ...

    Can someone help me convert this into vb.net please....
    Quote Originally Posted by varun432 View Post
    Hey can anyone help a newbie here
    Quote Originally Posted by varun432 View Post
    Guyz I just need to convert these query parameters to connect to the socket.io,, i have been trying and it says invalid json format,,,

    For generating token the first half I was successfully able to generate token using post but unable to connect to socket
    First, we're not at you're beck and call to do stuff like this. We're not paid enough to do things on demand (that's how you're coming across).
    Second you didn't give us anything to go off of... ok, invalid json format.... great... then the documentation should be telling you what the correct format should be. Yes? No? We're not going to sit here and try and guess what that format is.
    Lastly, why are you using a nodejs example to write vb code to do a socket connection? There should be plenty of valid, proper connections fomr VB to do that.


    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  6. #6

    Thread Starter
    New Member
    Join Date
    Aug 2020
    Posts
    6

    Re: Can someone help convert this nodejs code

    Thanks Guyz,,, 😊

  7. #7
    Lively Member
    Join Date
    Jan 2020
    Posts
    120

    Re: Can someone help convert this nodejs code


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width