SignalR client and Siemens Desigo CC WSI using TScHubConnection

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
hhau
Posts: 3
Joined: Fri 20 Mar 2020 08:50

SignalR client and Siemens Desigo CC WSI using TScHubConnection

Post by hhau » Fri 20 Mar 2020 11:20

Hello

First of all, I'm new to SignalR so please bear with me here.

I'm currently interfacing to a Siemens Desigo CC WSI (Web Service Interface) which support subscriptions using SignalR.

I have made mock-up C# wrapper which has been imported to Delphi (TLB) and I can make this work, however I cannot figure out how to transfer that to "setup" to a TScHubConnection.



single hub: norisHub
Subscription to: eventCountersHub


C# code (snips)

Code: Select all


    public interface IWSIEventSubscriberEvents
    {
        [DispId(1)]
        void OnWSIEventCountersEvent(string eventText);
    }

    void FireCOMEventCountersEvent(string data)
    {
      OnWSIEventCountersEvent(data);
    }



private IHubProxy HubEventCountersProxy { get; set; }



public string ConnectWSI()
        {
            mainDispatcher = System.Windows.Threading.Dispatcher.CurrentDispatcher;
            System.Net.ServicePointManager.ServerCertificateValidationCallback = ((sender, ClientCertificateOption, chain, sslPolicyErrors) => true);
            Connection = new HubConnection(_ServerURI);
            Connection.Closed += Connection_Closed;

            // Connects to eventCounters subscription hub.
            HubEventCountersProxy = Connection.CreateHubProxy("norisHub");
            HubEventCountersProxy.On("notifyEventCounters", (data) =>
                {
                    // Sends event to COM listener. in variable "data" we expects json string.
                    // This event will be handled in Delphi desigo app.
                    //
                    var jsonStr = new string[1];
                    jsonStr[0] = Convert.ToString(data);
                    mainDispatcher.Invoke(new MethodToInvokeDelegate(FireCOMEventCountersEvent), jsonStr);
                }
            );

In Delphi I have tried this.

Code: Select all

procedure TfrmMain.btnSubscribeSBClick(Sender: TObject);
var
  json: String;
  r : string;
  url : string;

begin
  url :=  'https://'+edServerAddress.Text + '/norisHub'; //Same as in the wrapper 
  SignalRClient.Url := url;

  SignalRClient.HttpConnectionOptions.Url := SignalRClient.Url; // in the demo URL's are identical

  SignalRClient.Register('notifyEventCounters', DoEventCountersReceipt, [varString]);
  SignalRClient.Start;

  {
  r := format('/sr/eventcounterssubscriptions/channelize/%s/%s',[FRequestId, FConnectionId]);
  json := GetData(r, json);
   }
end;
When I try this I get an error: Protocol error: unexpected packet type

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: SignalR client and Siemens Desigo CC WSI using TScHubConnection

Post by ViktorV » Mon 23 Mar 2020 10:56

SecureBridge components support the modern SignalR protocol used in ASP.NET Core; the deprecated SignalR protocol used in ASP.Net is not supported.
In your example, a connection is established to the SignalR server that supports the deprecated protocol, while SecureBridge components use a modern protocol. To use SecureBridge, you should connect to a SignalR server that uses a modern protocol.
See the MSDN documentation for the difference between ASP.NET SignalR and ASP.NET Core SignalR: https://docs.microsoft.com/en-us/aspnet ... etcore-3.1

hhau
Posts: 3
Joined: Fri 20 Mar 2020 08:50

Re: SignalR client and Siemens Desigo CC WSI using TScHubConnection

Post by hhau » Mon 23 Mar 2020 11:17

Hello Viktor

Thanks for your reply.

Unfortunately I cannot decide which version Siemens are using to implement signalR, their DesigoCC platform is quite new so I would expect that they would run a "modern" SignalR service in their Web service.

I'll ask what their plans are for this.

In the VS2017 wrapper we are using
Assembly Microsoft.AspNet.SignalR.Client
..
Microsoft.AspNet.SignalR.Client.2.2.3\lib\net45\Microsoft.AspNet.SignalR.Client.dll
..

I suppose that also indicate the usage of the older ASP.NET SignalR version you refer to?
I don't see any indications that ASP.NET SignalR has been deprecated?

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: SignalR client and Siemens Desigo CC WSI using TScHubConnection

Post by ViktorV » Tue 24 Mar 2020 09:27

You're right, the package Microsoft.AspNet.SignalR.Client is the SignalR version used in ASP.NET (see the MSDN docs https://docs.microsoft.com/en-us/aspnet ... etcore-3.1) , which is not supported by SecureBridge.
The protocol version used in ASP.NET was deprecated by Microsoft, for that reason SecureBridge supports only the SignalR version used in ASP.NET Core. We'll consider supporting the SignalR protocol version used in ASP.NET in the next version of SecureBridge.то микросот раньше объявляла ее deprecated, поэтому мы ее не поддерживали. Мы рассмотрим возможность поддержки в следующей версии

hhau
Posts: 3
Joined: Fri 20 Mar 2020 08:50

Re: SignalR client and Siemens Desigo CC WSI using TScHubConnection

Post by hhau » Tue 24 Mar 2020 10:23

Thank you Viktor

I understand that ASP.NET Core and ASP.NET SignalR is not compatible and that SecureBridge doesn't support ASP.NET, so far so good.

I just don't understand why you claim that SignalR for ASP.NET has been deprecated (by Microsoft), I don't see that anywhere on Microsoft documents or anywhere else including your link:

https://docs.microsoft.com/en-us/aspnet ... netcore-3.

Closest thing I can find is that the java client has been deprecated.

https://www.nuget.org/packages/Microsof ... lR.Client/

Anyways, it would be great if you add support for the ASP.NET SignalR since there are a lot of platforms running on ASP.NET. Meanwhile I will need to implement support for ASP.NET by writing a Wrapper component.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: SignalR client and Siemens Desigo CC WSI using TScHubConnection

Post by ViktorV » Tue 24 Mar 2020 13:44

hhau wrote: Tue 24 Mar 2020 10:23 Thank you Viktor

I understand that ASP.NET Core and ASP.NET SignalR is not compatible and that SecureBridge doesn't support ASP.NET, so far so good.

I just don't understand why you claim that SignalR for ASP.NET has been deprecated (by Microsoft), I don't see that anywhere on Microsoft documents or anywhere else including your link:

https://docs.microsoft.com/en-us/aspnet ... netcore-3.

Closest thing I can find is that the java client has been deprecated.

https://www.nuget.org/packages/Microsof ... lR.Client/

Anyways, it would be great if you add support for the ASP.NET SignalR since there are a lot of platforms running on ASP.NET. Meanwhile I will need to implement support for ASP.NET by writing a Wrapper component.
The protocol version used in ASP.NET had been deprecated by Microsoft for some time, but then Microsoft announced it wasn't deprecated anymore.

Post Reply