Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15458

Please help with socket api,,,

$
0
0
I am a hobbist programmer and able to deal with rest api,,,
But have no idea how to handle socket data connections

This is in the documentation to connect with socket data in nodejs
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);
}
});

Now I know how to login and receive token
Can someone please help with below 2

1) make connection to the socket
2) receive Live feed of subscribed events into a variable

Any help will be much appreciated


Documentation
https://developers.symphonyfintech.in/doc/marketdata/

Viewing all articles
Browse latest Browse all 15458

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>