Topics
Replies
alshdavid
02 Nov 2024, 06:34
( Updated at: 03 Nov 2024, 12:59 )
I am also getting this error. I am trying to simplify this with a Nodejs client (will use Rust for production)
const root = protobuf.loadSync(path.join(__dirname, '..', 'protobuf', 'OpenApiMessages.proto'))
const ProtoOAApplicationAuthReq = root.lookupType("ProtoOAApplicationAuthReq");
const client = new net.Socket();
await new Promise<void>(res => client.connect(5035, "demo.ctraderapi.com", res))
console.log('Connected')
const socket = new tls.TLSSocket(client)
const msg = ProtoOAApplicationAuthReq.create({
clientId: CLIENT_ID,
clientSecret: CLIENT_SECRET,
});
let bytes = ProtoOAApplicationAuthReq.encode(msg).finish()
socket.write(bytes)
socket.on('data', function(data) {
console.log('Received: ' + data);
});
I also tried sending the bytes individually to see if that was the problem
let bytes = ProtoOAApplicationAuthReq.encode(msg).finish()
for (const byte of bytes) {
socket.write(Buffer.from([byte]))
}
However both resulted in
FRAME_TOO_LONG"!Frame size exceeds allowed limit.
I tried adding the length header
function len(x: number) {
return [x,(x<<8),(x<<16),(x<<24)].map(z=> z>>>24).reverse()
}
console.log(bytes.length) // 110
console.log(len(bytes.length)) // [110, 0, 0, 0]
// +--------------------------+-----------------------------------------+
// | Message Length (4 bytes) | Serialized ProtoMessage object (byte[]) |
// +--------------------------+-----------------------------------------+
// |<---------- Message Length ------------->|
const b = Buffer.from([...len(bytes.length),...bytes])
console.log(b) // [110, 0, 0, 0, ...proto bytes]
socket.write(b)
Same error
@alshdavid
alshdavid
29 Oct 2024, 08:51
( Updated at: 29 Oct 2024, 16:20 )
RE: Emails not coming through or coming through too slowly / Webhooks?
PanagiotisCharalampous said:
Hi there,
Emails come immediately in my case, neither we have any other complaints regarding this. So most probably this is an issue with your email rather than the platform. If we receive more complaints, we will investigate further.
Best regards,
Panagiotis
Thanks! Unfortunately my original plan was to use the emails as a push event and data source for journaling however the emails themselves don't contain the right information for this.
I'm currently exploring using the open api capabilities for pulling historical data. Does the API support webhooks for order actions or is it only available via websocket?
Webhooks are ideal because I can use serverless handlers to process my trade data and put it into an SQL database to be queried/visualized later.
If it's only websockets, I'd be better off polling the open api endpoints every minute or something - or find some alternative trigger for pulling historical data
@alshdavid
alshdavid
03 Nov 2024, 12:58
This is also the case with Golang
Failing with
@alshdavid