Getting connection forcefully terminated

Created at 17 Jul 2023, 20:37
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
KR

krixfega

Joined 17.07.2023

Getting connection forcefully terminated
17 Jul 2023, 20:37


Hi, 

I'm using gRPC with Flutter and I keep getting 

`error ===gRPC Error (code: 2, codeName: UNKNOWN, message: HTTP/2 error: Connection error: Connection is being forcefully terminated. (errorCode: 10), details: null, rawResponse: null, trailers: {})===`

for days now. I compiled the proto files I got in the OpenAPIPy documentation from Spotware on GitHub.

 

I use the connecton.dispatchCall(ClientCall(

// call options

));

Any ideas what I'm doing wrong?


@krixfega
Replies

krixfega
18 Jul 2023, 12:02 ( Updated at: 21 Dec 2023, 09:23 )

I have tried using a pure socket connection and I keep getting this response

[21, 3, 1, 0, 2, 2, 70] 

 

CODE: 

Socket socket = await Socket.connect('demo.ctraderapi.com', 5035);

var req = ProtoOAApplicationAuthReq()

..clientId = dotenv.get('CLIENT_ID')

..clientSecret = dotenv.get('CLIENT_SECRET');

var newByteArray = req.writeToBuffer();

var lengthOfByteArray = newByteArray.length;

debugPrint('lengthOfByteArray ===$lengthOfByteArray===');

Int32 int32 = Int32(lengthOfByteArray);

var newArray = int32.toBytes().reversed.toList() + newByteArray;

print(newArray);

socket.write(newArray);

// await socket.flush();

socket.listen((event) {

debugPrint('event ===${event.length}=== $event');

var response = ProtoOAApplicationAuthRes.fromBuffer(event);

debugPrint('response ===${response.payloadType}=== $response');

debugPrint('received ===${response.toString()}===');

});

 


@krixfega