AllanF 0 Posted June 1, 2023 I already have a TSslWSocketServer listening on port NNNN and successfully accepts TSSLWSocket client connections. All this happens within the context of my Delphi Applications. Now I need to provide an API in my application. I want to use the existing TSslWSocketServer to listen to any REST calls also. REST call comes in successfully and I can read the content in DataAvailable Event too. My problem is that I cannot send back any message to the REST Client. I am using (Sender as TClientConnection).SendStr('Hi') but it does not reach the REST Client. I know this is not the appropriate way but I just need to send some indication that message has been received. Share this post Link to post
Angus Robertson 577 Posted June 1, 2023 REST client requests are usually sent using HTTPS, this should be obvious where the data you receive from the client contains HTTP headers, so you have to reply using HTTP, your Hi response will simply be ignored by the client. Ideally, you would be using the web server component, but creating a simple HTTP header and response HTTP page is only a few lines of code. Angus Share this post Link to post
AllanF 0 Posted June 1, 2023 Hi Angus, My REST Client request is Secured TLS. Also (Sender as TClientConnection).SendStr('Hi') wherein Type TClientConnection = class(TSSLWSocketClient) It is essential that I use Secured Layer only. Share this post Link to post
Angus Robertson 577 Posted June 1, 2023 So this is just a private protocol, not really REST. Commonly, textual responses are followed by CRLF, that may be what the client is expecting. Angus 1 Share this post Link to post