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
I have tried using the following code to get the market data and it is working but sometimes I'm getting the error "socket has been ended by other party" and then I have to restart the server to make it work again.
@liampauling Thanks for your response.
I'm resubscribing right now on connection drop. I thought there must be some other way to prevent this error from originating.
I have tried using the following code to get the market data and it is working but sometimes I'm getting the error "socket has been ended by other party" and then I have to restart the server to make it work again.
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");
});
/* Send authentication message */
client.write('{"op": "authentication", "appKey": "APIKEY", "session": "TOKEN"}\r\n');
/* Subscribe to order/market stream */
stream.write(
{"op":"marketSubscription","marketFilter":{"marketIds":["1.160865586"],"bettingTypes":["ODDS"],"eventTypeIds":["2"],"eventIds":["29390842"]},"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);
})
The text was updated successfully, but these errors were encountered: