Issues with WebPubSub and SignalR Integration

Loges Logon 0 Reputation points
2024-11-04T15:12:46.6366667+00:00

I am working on a sample demo to make WebPubSub functional. I tried using the SignalR service, but WebPubSub seems to work for my case via API client with the following GET request:

<web-pubsub-endpoint>/socket.io/?EIO=4&transport=

However, it displays a "not found" error.

/*client.js*/
const io = require("socket.io-client");
const socket = io("<web-pubsub-socketio-endpoint>", {
    path: "/clients/socketio/hubs/Hub",
});
// Receives a message from the server
socket.on("hello", (arg) => {
    console.log(arg);
});
// Sends a message to the server
socket.emit("test", "range");

I found the demo at this link.

I am looking to replicate this across the region for business continuity. Additionally, I am using the standard plan at $1.61 and want to avoid scaling up. In the future, I plan to implement long polling for my app and use server events.

Azure Web PubSub
Azure Web PubSub
An Azure service that provides real-time messaging for web applications using WebSockets and the publish-subscribe pattern.
79 questions
Azure SignalR Service
Azure SignalR Service
An Azure service that is used for adding real-time communications to web applications.
151 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 27,851 Reputation points Microsoft Employee
    2024-11-05T17:52:55.6066667+00:00

    Loges Logon, Based on my understanding of your issue description, you are receiving 404 error

    I see that you have provided the path option: path: "/clients/socketio/hubs/Hub",

    --On the Azure Portal :

    1. Navigate to the Keys Settings blade of Web PubSub for Socket.IO
    2. Under Client Endpoint Generator – Please ensure that the Hub and Client Path – are correct and there are no typos.

    You may also check this thread which discusses on a similar thread.

    --Further on your requirement , as outlined in the doc - the Azure Web PubSub service is not a replacement for Azure SignalR Service. They're targeting different scenarios.
    In that case, Azure SignalR for long polling and server-sent events will be better suited.

    --Web PubSub service tiers are differentiated by the number of concurrent connections, messages and maximum units allowed. Per your requirement you may start with Standard tier and then scale to Premium ( but you can always scale down).
    https://azure.microsoft.com/pricing/details/web-pubsub/

    For more info, checkout: How do I choose between Azure SignalR Service and Azure Web PubSub service?

    If you are able to post an image or screenshot now, please share after concealing any private details.

    Apologies for the issues that you experienced with Q&A platform, I'll will relay this feedback internally to our platform team.


    If the answer helped (pointed, you in the right direction) > please click Accept Answer to benefit the community find answers quickly to similar question.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.