You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is that once I start getting the odds then it continue even if I close my browser.
Lets suppose in one browser tab I have open odds for cricket and in 2nd browser tab for tennis. Now, I'm getting the odds for both which is good. Now, if I close the first browser tab of cricket then I want to stop receiving the odds but in my server I can still see the odds receiving.
So, how can I stop receiving the odds once the browser is closed or is there any event to stop receving the odds.
Any help or suggestions or ideas?
The text was updated successfully, but these errors were encountered:
I'm using the following code multiple times to get the odds of different event.
var tls = require('tls');
/* Socket connection options */
var options = {
host: 'stream-api.betfair.com',
// host: 'stream-api-integration.betfair.com',
port: 443
}
/* Establish connection to the socket */
var client = tls.connect(options, function () {
console.log("Connected");
});
function getMarketData(marketIdArray, eventTypeIdArray, eventIdArray) {
/* Send authentication message */
client.write('{"op": "authentication", "appKey": "APIKEY", "session": "TOKEN"}\r\n');
/* Subscribe to order/market stream */
stream.write(
{"op":"marketSubscription","marketFilter":{"marketIds":[${marketIdArray}],"bettingTypes":["ODDS"],"eventTypeIds":[${eventTypeIdArray}],"eventIds":[${eventIdArray}]},"marketDataFilter":{}}\r\n
);client.on('data', function(data) {
console.log('Received: ' + data);
});
client.on('close', function() {
console.log('Connection closed');
});
client.on('error', function(err) {
console.log('Error:' + err);
});
}
router.get('/getMarketData', function(req, res, next) {
getMarketData(req.marketIdArray, req.eventTypeIdArray, req.eventIdArray);
})
The problem is that once I start getting the odds then it continue even if I close my browser.
Lets suppose in one browser tab I have open odds for cricket and in 2nd browser tab for tennis. Now, I'm getting the odds for both which is good. Now, if I close the first browser tab of cricket then I want to stop receiving the odds but in my server I can still see the odds receiving.
So, how can I stop receiving the odds once the browser is closed or is there any event to stop receving the odds.
Any help or suggestions or ideas?
The text was updated successfully, but these errors were encountered: