We use cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.
Hello.
I'm trying to connect and send data to a socket.io server but I'm having trouble. I can connect and send data with postman, but in Delphi it just doesn't work.
I can connect but when I send the data, it disconnects.
Any tips?
Thanks in advance.
Here is the code I use
var
WSClient: TsgcWebSocketClient;
socket_io: TsgcWSAPI_SocketIO;
begin
WSClient := TsgcWebSocketClient.Create(self);
socket_io := TsgcWSAPI_SocketIO.Create(self);
WSClient.Host := 'xxxx'; //here goes the real host name
WSClient.Port := 443;
WSClient.Specifications.RFC6455 := True;
WSClient.TLS := True;
if WSClient.Connect() then
begin
Memo1.lines.add('connect true')
end
else
Memo1.lines.add('connect false');
WSClient.WriteData('42{"new message": "123"}');
Please login to post a reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here. Register Here »