Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SignalR Hub Overloads

I tried creating a basic hub with two Receive methods, one accepts a string and the other an int. This causes an error stating that the method cannot be resolved. Commenting out one of the methods gets rid of the error and everything works.

Is it possible to have overloads of a method in my hub? Could something like overloads be done?

like image 534
Mazjuro Zoro Avatar asked Mar 28 '13 16:03

Mazjuro Zoro


1 Answers

SignalR does support overloading server-side Hub methods, but the overloads must have a different arity, i.e. take a different number of arguments.

If the overloads have the same arity, SignalR will be unable to resolve which overload is being called, even though the overloaded Hub methods accept different types.

like image 185
halter73 Avatar answered Nov 02 '22 03:11

halter73