Closed Thorium closed 2 years ago
It was so convenient to use the Hubs with Typescript in AspNet.SignalR with EnableJavaScriptProxies
(...or you could have generate the proxies manually with signalr.exe):
// Typescript types:
interface ISignalHub extends SignalR { SignalHub : any; }
$.connection.hub.url = "/signalr";
(<ISignalHub>$.connection).SignalHub.server
.myServerMethod("some parameter").done(function (result) {
// it just works!
});
Compare the AspNetCore version, so much wizzard-walkthrough, and still not showing is it possibe to call a Hub server side method:
There is no equivalent to proxies in ASP.NET Core.
The same code in ASP.NET Core SignalR would look like:
connection.invoke("myServerMethod", "some parameter")
.then(function (result) {
// code
});
The walkthrough shows calling a method on the server in https://docs.microsoft.com/aspnet/core/tutorials/signalr-typescript-webpack?view=aspnetcore-2.1&tabs=visual-studio#enable-client-and-server-communication-1
Closing this per @BrennanConroy's reply.
How do I set hubConfig to
EnableJavaScriptProxies
true?Document details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.