TIdHTTPWebsocketClient and TNetHTTPClient

  

If I use:

try
wsClient := TIdHTTPWebsocketClient.Create(Self);
wsClient.Host := iniSettings.ReadString(‘General’, ‘webSocketHost’, ‘localhost.XXXXX.com’);
wsClient.Port := iniSettings.ReadInteger(‘General’, ‘webSocketPort’, 5656);
wsClient.Connect;
wsClient.UpgradeToWebsocket;
wsClient.OnTextData := ClientTextDataReceived;
wsClient.IOHandler.Write(‘request=messageBroker&channel=XXXXX-local-customer-display&command=register&id=’ + IntToStr(clientID));
except
ShowStatusMessage(‘Unable to connect with EPSI’);
end;

Only: if I use

Mess:= TStringList.Create;
Mess.Text:= ‘request=messageBroker&channel=XXXXX-local-customer-display&command=register&id=’ + IntToStr(clientID);
Host:= iniSettings.ReadString(‘General’, ‘webSocketHost’, ‘localhost.XXXXX.com’);
Port:= iniSettings.ReadInteger(‘General’, ‘webSocketPort’, 5656);
aUrl:= ‘http://’ + Host + ‘:’ + IntToStr(Port);
NetHTTPRequest.Post(aurl, Mess);

I get error

Request error. Error sending data: (12029) A connection with the server could not estabilised.

I can not use TIdHTTPWebsocketClient.

What am I doing wrong?

Does any other WebSocket client exist that works with FireMonkey?

Comments are closed.