ServerEventsClient (C#) fails to SubscribeToChannelsAsync on non default SubscribersPath

I have configured custom path for ServerEventsFeature:

StreamPath = “/sse/event-stream”,
HeartbeatPath = “/sse/event-heartbeat”,
UnRegisterPath = “/sse/event-unregister”,
SubscribersPath = “/sse/event-subscribers”

ServerEventsClient connects, but fails SubscribeToChannelsAsync with 404 Not Found.
Default path works fine.
ServiceStack version 8.2.2

ServerEventsClient uses its confiugred baseUrl to send APIs like UpdateEventSubscriber used in SubscribeToChannelsAsync, which also needs to be configured with the correct base URL.

Otherwise SubscribeToChannelsAsync is just an extension method for calling the UpdateEventSubscriber API which you can use with your own ServiceClient, e.g:

await sseClient.ServiceClient.PostAsync(
   new UpdateEventSubscriber { 
        Id = sseClient.ConnectionInfo.Id, 
        SubscribeChannels = channels.ToArray() 
});
sseClient.Update(channels);

Which you can use if with a custom Request DTO if you need to use a different route, e.g:

[Route("/sse/event-subscribers/{Id}")]
public class UpdateEventSubscriber : IPost,IReturn<UpdateEventSubscriberResponse>
{
    public string Id { get; set; }
    public string[] SubscribeChannels { get; set; }
    public string[] UnsubscribeChannels { get; set; }
}

If you are referring to setting the right base baseUri of ServerEventsClient, I am doing that.

ServerEventsClient = new ServerEventsClient(Conf[“BettingUrl”] + “/sse”);

ServerEventsClient.Connect() works

await ServerEventsClient.SubscribeToChannelsAsync fails with 404

Fiddler shows the right route: https://localhost:5003/sse/event-subscribers/gUmE22C6Dbe6I2e26zzb

I also tried using my own extension with the custom request dto as suggested (on the client side).
Still the same.

A call to “/sse/event-stream” endpoint shows the right path:
{…
“updateSubscriberUrl”:“https://localhost:5003/sse/event-subscribers/1NX5Lb3IC7vanJjUaxfT” etc…
}

Should the client just work if the base uri is set up correctly, or are there other concrete steps too?
My goal is just to prefix all SSE related routes with “/sse”.

The UpdateEventSubscriber API wasn’t configurable before, but just added it in the latest v8.2.3+ now available in our Pre Release packages, where you’ll be able to configure it with:

UpdateSubscribersPath = "/sse/event-subscribers/{Id}"
1 Like