I want to stablish a connection between Postman and my SignalR application. I am having problems with sending messages, I am able to connect to the hub, but not able to send messages from Postman.
What I have is the typical configuration, this is my Hub class
using Microsoft.AspNetCore.SignalR;
namespace LocalReads.API.Hubs {
public class NotificationHub : Hub
{
public async Task SendNotification(string message)
{
await Clients.All.SendAsync("ReceiveNotification", message);
}
public override Task OnConnectedAsync()
{
Console.WriteLine("Client connected: " + Context.ConnectionId);
return base.OnConnectedAsync();
}
}
}
I am registering it in the Program.cs file like the following
builder.Services.AddSignalR();
//... some code
app.MapHub("notification-hub");
Then when I go to Postman, I am able to connect to the hub as shown in the image below
The weird thing comes when sending a message, as you can see I am using the following message:
{"arguments":["Hey"],"invocationId":"0","target":"SendNotification","type":1}\u001e
when I send that, I see a sent message in Postman, image below
but no answer at all from the Hub, even my breakpoint in Visual Studio is not being hit,
I though it could be the message not using the right separator character, so I used one that seemed to work for everyone:
{ "arguments": ["just a test"], "target": "HubMethod", "type": 1 }
That character is being used in many tutorials and web pages, I just copied and pasted from this StackOverflow link: Invoking SignalR from Postman
When I am trying with that message the hub just get disconnected with the following error:
So, I went to see a Milan Jovanovic video in YouTube (https://youtu.be/9_pRk7PwkpY?si=XjNQgsmXZuZfwVU1) downloaded the same code he wrote, used the same message in Postman and I had the same exactly error, just like in my project, even if I did the same steps as Milan did in his video.
I am using this nuget package, with
Milan is using, with
So far, this is all the info I have, I don't know what it could be, if it's something related with certificates, I am not sure, or probably I am missing some vital step for this to work.


