Sending/receiving ProtoOA messages
Sending/receiving ProtoOA messages
09 Oct 2019, 15:28
I would like to get some help for how to send/receive ProtoOA messages. I am silly I know. I have been studying
the OpenAPI sample, but I have to write a simple console application without threads and other extras.
The application has to know the following (base) functions only:
- connect to OpenAPI (it works)
- Send any ProroOA message (for example: Authorization request or get the current price....)
- Receive and process the data.
- exit
here is my code but it halted at the Transmit function. I do not know why and how to handle it.
Someone could send me a working example to berich1198@gmail.com
Thank you very much!
Beri
try { TcpClient client = new TcpClient(apiHost, apiPort); apiSocket = new SslStream(client.GetStream(), false, new RemoteCertificateValidationCallback(ValidateServerCertificate), null); apiSocket.AuthenticateAsClient(apiHost); try { SendAuthorizationRequest(outgoingMsgFactory, writeQueueSync); Transmit(apiSocket, writeQueueSync, lastSentMsgTimestamp); } catch (Exception e) { Console.WriteLine("Error: {0}", e); return; } Thread.Sleep(100); try { Listen(apiSocket, readQueueSync); } catch (Exception e) { Console.WriteLine("Error: {0}", e); return; } } catch (Exception ex) { Console.WriteLine("Establishing SSL connection error: {0} Program aborted.", ex); return; } apiSocket.Close();
Replies
afhacker
09 Oct 2019, 16:45
You can also use the library I wrote: https://github.com/afhacker/Connect
It has a console tester app, which you can use for testing different API commands.
My lib also supports Rx, which you can use for receiving the API messages on an IObservable stream.
@afhacker
BenjaminR
09 Oct 2019, 18:55
Unfortunately the OpenAPi Sample is not suitable for me. I spent 2 weeks with it without any results. I need more simplier and workable console example that I can build step by step.
Thank you for Algodeveloper's help: but that version has more errors when I wanted to build.
Someone send me an example to berich1198@gmail.com. Please!
Thanks.
@BenjaminR
PanagiotisCharalampous
09 Oct 2019, 15:31
Hi Be Rich,
There is a fully working example using Open API 2.0 here.
Best Regards,
Panagiotis
@PanagiotisCharalampous