Last post Mar 23, 2017 09:32 AM by Eric Du
Mar 22, 2017 06:18 PM|RobertRoos|LINK
I'm experimenting with SignalR and liking it so far, quite a lot. I was thinking that i wanted to add a method to my hub, for example a method like this:
public void Uonline(string roomId)
The thought here is to be able to when clicking a button retrieve the clients currently connected and present them. But my question is how to run this method from the view? I have another one at the moment called Notify with 4 parameters, doing almost the
same thing. I can access this one by writing:
chat.server.notify(para1, para2, para3, para4);
However if trying to do the same with my new method
I only get a method not found error in the JS-console.
Sorry for such a newbe question, but I cant seem to figure this out!
Mar 23, 2017 09:32 AM|Eric Du|LINK
I reproduce the issue on my side by declaring a new method named
public, please check your hub method definition again and make sure it is declared as public. Besides, you could try to define a new hub class with methods or use the
HubName attribute to specify a different name for clients to use, and test if the method could be called.
public class ChatHub : Hub