Wednesday, 24 May 2023
  6 Replies
  1.3K Visits
  Subscribe
Hello,
I want to connect to our SignalR server using the example from the demo application.
What am I doing wrong?

fSignalR.pas:


procedure TFRMSignalR.btnConnectClick(Sender: TObject);
begin
WSClient.URL := 'https://moxxx.xxxxl:9248/xxxxomSR/notify';

WSClient.Authentication.Basic.Enabled := True;
WSClient.Authentication.URL.Enabled := True;
WSClient.Authentication.Password := 'xxxxxxxxxxxx';
WSClient.Authentication.User := 'userrrrr';

SignalR.SignalR.Hubs.Clear;
SignalR.SignalR.Hubs.Add('NotifyHub');

WSClient.Active := True;
If WSClient.Active then
Beep;
end;


In different options I can not establish a connection.
I easy establish connection in T*************on component. But cant do this in TsgcWebSocketClient / TsgcWSAPI_SignalR.

Regards,
Max
1 year ago
·
#1600
Hello,

Without more info I cannot help you, please answer the following questions below:

1. Are you trying to connecto to a SignalR or a SignalRCore server? the protocols are different
2. The server requires some type of authentication? if yes, which? in your code seems you are trying to setup some type of authentication, but not sure which.
3. WSClient.URL := 'https://moxxx.xxxxl:9248/xxxxomSR/notify' ... won't work, only ws or tcp works for websocket component. Use the following

WSClient.Host := 'moxx.xxx...';
WSClient.Port := 9248;
WSClient.Options.Parameters := '/xxxxomSR';
WSClient.TLS := True;

But without knowing the exact URL I cannot help more.

Kind Regards,
Sergio
1 year ago
·
#1601
1. I'm try connect to SignaRcore server with using .NET 6.0
2. Yes Basic Authentication (bellow example client in C#)
3. My serwer works on IIS and use https protocol
bellow client in C# works very well:


var url = "https://moxxx.xxxxl:9248/xxxxomSR/notify";
var credential = Convert.ToBase64String(System.Text.Encoding.GetEncoding("UTF-8").GetBytes("userrrrr" + ":" + "xxxxxxxxxxxx"));

connection = new HubConnectionBuilder()
.WithUrl(uri, options =>
{
options.Headers.Add("Authorization", $"Basic {credential}");
})
.WithAutomaticReconnect()
.Build();

try
{
await connection.StartAsync().ConfigureAwait(true);
MessageBox.Show("Connected ok");
}
catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); }
1 year ago
·
#1602
Hello,

If the server is a SignalRCore server, then don't use the TsgcWSAPI_SignalR component, use the TsgcWSAPI_SignalRCore component.

Kind Regards,
Sergio
1 year ago
·
#1603
Hello,
As far as I understand Connect is served on the TsgcWebSocketClient component. Communication on SognalR Core right?
I'm stuck on the connection.
Firstly, I reached the OnException event that there are not enough Indy libraries in Demo Example. Ok added them libeay32.dll, ssleay32.dll

Now code like this:

WSClient.Port := 9248;
WSClient.TLS := True;
WSClient.Host := 'moxxx.xxxxl.pl';
WSClient.Options.Parameters := '/xxxxomSR';
WSClient.Authentication.Password := 'xxxxxxxxxxxx';
WSClient.Authentication.User := 'userrrrr';
WSClient.Connect();

Generate error: 'HTTP/1.1 404 Not Found'

Code like this:


WSClient.Port := 9248;
WSClient.TLS := True;
WSClient.Host := 'moxxx.xxxxl:9248/xxxxomSR/notify'
WSClient.Options.Parameters := '/xxxxomSR';
WSClient.Authentication.Password := 'xxxxxxxxxxxx';
WSClient.Authentication.User := 'userrrrr';
WSClient.Connect();

Generaate error: 'HTTP/1.1 401 Unauthorized'

What is wrong?

And ok, ill be use TsgcWSAPI_SignalRCore after when i'll be logged :)

Best regards,
Max
1 year ago
·
#1604
Hello,

I need the full parameters to test the connection, if you want I try it, send me the full url and authentication details to my email: info@esegece.com

Kind Regards,
Sergio
1 year ago
·
#1605
Hello,

Ok Sergio,
I will send you the server side code on Friday (I have a vacation tomorrow)
Thank you in advance

Best regards,
Max
  • 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
· Insert · Remove
  Upload Files (Maximum 10MB)