07-24-2023, 10:05 AM
So I just started off trying to work with Signalr for a project I'm working on. I have fairly little experience with JScript or Jquery, but a decent amount of experience with C#
I made the tutorial project on microsoft docs for a chat app [over here][1].
So this is probably a fairly dumb question in the eyes of most.
in the script I replaced
chat.server.Send($('#displayname').val(), $('#message').val());
with
chat.server.GetServerName($('#displayname').val(), $('#message').val());
and in the hub added the function
public void GetServerName(string name, string message)
{
// Call the broadcastMessage method to update clients.
Clients.All.broadcastMessage(name, message);
}
But I'm getting the following error.
> Uncaught TypeError: chat.server.GetServerName is not a function
If all the rest of the project is identical, how does this happen?
My apologies if this is a duplicate, I've been looking for almost 5 hours with no sensible answer to my question elsewhere that I'm aware of.
[1]:
I made the tutorial project on microsoft docs for a chat app [over here][1].
So this is probably a fairly dumb question in the eyes of most.
in the script I replaced
chat.server.Send($('#displayname').val(), $('#message').val());
with
chat.server.GetServerName($('#displayname').val(), $('#message').val());
and in the hub added the function
public void GetServerName(string name, string message)
{
// Call the broadcastMessage method to update clients.
Clients.All.broadcastMessage(name, message);
}
But I'm getting the following error.
> Uncaught TypeError: chat.server.GetServerName is not a function
If all the rest of the project is identical, how does this happen?
My apologies if this is a duplicate, I've been looking for almost 5 hours with no sensible answer to my question elsewhere that I'm aware of.
[1]:
[To see links please register here]