Wednesday, 23 September 2020
  14 Replies
  2.7K Visits
  Subscribe
Hello, Good evening.

Im trying to use sgcwebsocketClient to connect to AWS IoT , the connection is successful but when i suscribe to a topic a weird behavior happens , the mqtt Connect event fires again and again , i got Connected.. connected... in and endless loop.


WSClient1.Port := 443;
WSClient1.Host := 'someendpoint.com';
WSClient1.TLS := True;
WSClient1.Proxy.Enabled := False;
WSClient1.Extensions.DeflateFrame.Enabled := False;
WSClient1.Specifications.RFC6455 := True;
WSClient1.Options.Parameters := '/mqtt';

MQTT1.Authentication.Enabled := False;

WSClient1.Active := True;


procedure TMainForm.MQTT1MQTTConnect(Connection: TsgcWSConnection; const
Session: Boolean; const ReturnCode: TmqttConnReturnCode);
begin
Memo1.Lines.Add('[Conectado...]');
MQTT1.Subscribe(
'environment/clientIdentifier/qry'
);
end;



Thanks you, Regards.
4 years ago
·
#535
Thank you for all your help, it is working now.
4 years ago
·
#534
Hi,

I've implemented a new authentication type: custom authentication, which allows to set custom parameters (by default is /mqtt) and custom headers. So now, if you enable CustomAuthentication, you can set the Parameters of the MQTT connection


CustomAuthentication.Enabled := True;
CustomAuthentication.Parameters := '/mqtt';
CustomAuthentication.WebSockets := True;


Please download the latest update from your account to get this new feature.

Kind Regards,
Sergio
4 years ago
·
#533
Hi,

Beta Indy includes a custom indy version with support for TLS 1.3, ALPN... while Beta uses the Indy version you've installed in your IDE.

Kind Regards,
Sergio

Thank you , one last question , what's the difference between Beta and Beta Indy.
4 years ago
·
#532
Hi,

If you use SignatureV4 as authentication, you musn't set "/mqtt" in host because this is set automatically by component when creates the connection parameters. If you check the prior screenshot, you will see that I only set the Amazon Endpoint without any parameter. SignatureV4 requires an API and Secret key linked to an user, this user has enough privileges to get IoT messages? in my test works well.

Kind regards,
Sergio

Hello again , I get the beta version but when I tried to connect I always get a host not found , we use an endpoint like this: bus.mydomain.com/mqtt. , if I remove the /mqtt it don't throw error but of course I don't get any response , in the MQTT normal component I use Parameter to add the /mqtt , but I don't have that option in amazon component.

Kind Regards.
WsClient.Options.Parameters := '/mqtt' , this is how it works in the normal Websocket component, there is a way to do it in the amazon component?

Regards.
Hello again , I get the beta version but when I tried to connect I always get a host not found , we use an endpoint like this: bus.mydomain.com/mqtt. , if I remove the /mqtt it don't throw error but of course I don't get any response , in the MQTT normal component I use Parameter to add the /mqtt , but I don't have that option in amazon component.

Kind Regards.
Thank you , one last question , what's the difference between Beta and Beta Indy.
4 years ago
·
#528
If you have an active license, you can download from your account as sgcWebSockets 4.4.3 Beta.

Kind regards,
Sergio
4 years ago
·
#527
Thank you for your help , where I can download the update ? Is included in the oficial download Page ?

Kind Regards.
4 years ago
·
#526
Hi,

After reading the Amazon AWS IoT Documentation, I've updated the Amazon IoT client and now supports MQTT over websockets using SignatureV4 as authentication. I've added the possibility to set the MQTT username/password for custom authentications too.

amazon_aws_signaturev4.png

Kind regards,
Sergio
4 years ago
·
#525
Hi,

The credentials must be set in MQTT component, but in this component the object is protected. You can access if you inherit a new class from TsgcIoTAmazon_MQTT_Client and then you can access to "MQTT" property.

Kind regards,
Sergio
4 years ago
·
#524
Hello Again :) , thanks for your help , I tried with the component for AWS but the only way to use it is trough Certificates , we are not using certs , we use username and password , ssl , port 443 , and is mqtt over web socket , I found that I can disable the certificate functionality but I don't find how to set the credentials.

Thank you , Regards.
4 years ago
·
#523
Hi,

If you connect to Amazon AWS IoT there is a component specific for it, you can check the following links:

Compiled Demo
https://www.esegece.com/download/protocols/sgcIOT.zip

Documentation
https://www.esegece.com/help/sgcWebSockets/#t=Components%2FIoT%2FAmazon%2FIoT_Amazon_MQTT_Client.htm

The source of demo is inside Demos/IoT

Kind regards,
Sergio
4 years ago
·
#522
Im using sgcwebsockets version 4.2 , and aws is using mqtt over websocket , wss://endpint/mqtt
  • Page :
  • 1
There are no replies made for this post yet.
Submit Your Response
Upload files or images for this discussion by clicking on the upload button below.
Supported: gif,jpg,png,jpeg,zip,rar,pdf,pas,dfm,dpr,dproj,dpk
· Insert · Remove
  Upload Files (Maximum 10MB)