-
Sep 11th, 2020, 10:50 AM
#1
Thread Starter
New Member
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.
-
Sep 12th, 2020, 07:19 AM
#2
Thread Starter
New Member
Re: Please help with socket api,,,
Hey can anyone help a newbie here
-
Sep 12th, 2020, 02:29 PM
#3
Thread Starter
New Member
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
-
Sep 13th, 2020, 01:06 AM
#4
Re: Can someone help convert this nodejs code
Originally Posted by varun432
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.
-
Sep 14th, 2020, 07:12 AM
#5
Re: Can someone help convert this nodejs code
Originally Posted by varun432
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....
Originally Posted by varun432
Hey can anyone help a newbie here
Originally Posted by varun432
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
-
Sep 14th, 2020, 09:41 AM
#6
Thread Starter
New Member
Re: Can someone help convert this nodejs code
-
Sep 14th, 2020, 11:11 PM
#7
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|