Hi All,
This snippet is how we setup our client in javascript:
...
this.connection = new signalR.HubConnectionBuilder()
.withUrl(URL_ENDPOINT, { accessTokenFactory: () => this.loginToken })
.build();
this.connection.on("ReceiveNotification", (info, kind) => this.receiveNotification(info, kind));
yield this.connection.start();
...
Where the info is an object (marshalled as json) & kind is an enum (int).
When setting up a TscHubConnection in Delphi,
how do i map these expected parameters to the TscHubConnection.Register method?
eg:
hubConnection.Register('ReceiveNotification', HandleReceiveNotification, [var??, var??] );
Tia, Rj
How to map parameters in TscHubConnection.Register method?
Re: How to map parameters in TscHubConnection.Register method?
The type of the parameter should match the type of the method declared on the server. For example, if the method is declared in the following way:
then the method should be registered as follows
Code: Select all
public async Task ReceiveNotification(string info, int kind)
Code: Select all
hubConnection.Register('ReceiveNotification', HandleReceiveNotification, [varString, varInteger]);
Re: How to map parameters in TscHubConnection.Register method?
Hi VictorV,
Our SignalR server has been implemented in asp.net core,
and the first parameter (info) I reffered to is a C# class, used as a POCO.
So the question still remains, what's the TVarType i have to use?
Thanks, Rj
Our SignalR server has been implemented in asp.net core,
and the first parameter (info) I reffered to is a C# class, used as a POCO.
So the question still remains, what's the TVarType i have to use?
Thanks, Rj
Re: How to map parameters in TscHubConnection.Register method?
You can assign the type varString to the parameter info, in which case you'll be able to read the responce as a JSON string and use it at your discretion.
Re: How to map parameters in TscHubConnection.Register method?
Hi,
Thanks for your suggestion, i have tried it, and my callback function gets called, however Values array has zero elements!?
Any ideas?
Tia, Rj
Thanks for your suggestion, i have tried it, and my callback function gets called, however Values array has zero elements!?
Any ideas?
Tia, Rj
Re: How to map parameters in TscHubConnection.Register method?
Hi,
Little update here...
After a restart of my session, i have a json-payload as parm in my callback!
Thanks, Rj
Little update here...
After a restart of my session, i have a json-payload as parm in my callback!
Thanks, Rj
Re: How to map parameters in TscHubConnection.Register method?
Thank you for interest to our product.
Feel free to contact us if you have any further questions about our products.
Feel free to contact us if you have any further questions about our products.