Reputation: 599
We are having SignalR hub like,if we have API with ref or out param SignalR hubs are not loading in to Website,
If i removed this "ref or out" param type it working fine.
And I am getting the below error if i access "Signalr/hubs" in browser
Expression of type 'System.Int32&' cannot be used for parameter of type 'System.Int32' of method 'Int32 test(Int32 ByRef)'
Hub Code:
public class TestCommHub : Hub {
public void test(ref int intVal) { intVal = 0; }
}
Can anyone help to proceed this.
Upvotes: 0
Views: 223
Reputation: 8276
The methods you write in C# in the Hub class are supposed to be available to be called from JavaScript. That will be done though a JavaScript proxy. Most cases the generated proxy, unless you manually define yours. (about the proxy)
JavaScript will simply not understand the C# ref
and out
parameters.
However, SignalR will serialize your complex object parameters into JSON so you can use it in JavaScript.
Upvotes: 1