This website uses cookies to enhance site navigation, analyze site usage, and assist in our marketing efforts. By clicking “Accept All” you are providing your consent to our use of all cookies. Alternatively, please provide your choice by pressing “Customize Cookies”. For more information, please read our Privacy policy
calum2atkins
05 Feb 2025, 22:32 ( Updated at: 14 Feb 2025, 18:16 )
RE: RE: C_BOT cloud instance receiving data from websocket for placing order.
toolsche said:
Hi, For this instance does this send any transactions placed? I'm looking to connect all transactions into my database, but always have the server disconnecting instantly after a message is sent
const WebSocket = require('ws');
const ws = new WebSocket('wss://demo.ctrader.com:5035/');
ws.on('open', function open() {
console.log('✅ Connected to cTrader WebSocket');
// Send a ping request
ws.send(JSON.stringify({
method: "ProtoOAPingReq",
clientMsgId: "2"
}));
});
ws.on('message', function incoming(data) {
console.log('📩 Received:', data.toString());
});
ws.on('close', function close(code, reason) {
console.log(`❌ WebSocket closed (Code: ${code}, Reason: ${reason})`);
});
ws.on('error', function error(err) {
console.error('❌ WebSocket Error:', err);
});
@calum2atkins