user authentication for web pubsub

Peter Daniels 40 Reputation points
2024-03-01T15:03:30.9633333+00:00

Azure Web App has authentication of users under settings as a means of app access without effecting code. Where is this in Web pubsub? Also, there is no publish profile under Web pubsub, so how is publishing done from Visual Studio?

Azure Web PubSub
Azure Web PubSub
An Azure service that provides real-time messaging for web applications using WebSockets and the publish-subscribe pattern.
60 questions
Azure
Azure
A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.
947 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,618 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sedat SALMAN 13,160 Reputation points
    2024-03-02T06:43:54.9333333+00:00

    you can leverage Azure AD for user authentication and use it to issue access tokens for Web PubSub

    https://learn.microsoft.com/en-us/azure/azure-web-pubsub/concept-azure-ad-authorization

    https://learn.microsoft.com/en-us/azure/azure-web-pubsub/howto-use-managed-identity

    https://learn.microsoft.com/en-us/azure/azure-web-pubsub/samples-authenticate-and-connect

    Azure Web PubSub doesn't have a "publish profile" like Web Apps. To publish messages to Azure Web PubSub you need to deploy your code. Code deployment doesn't apply to Web PubSub in the same way as it does for Azure Web Apps. However, you might be referring to how to integrate Web PubSub into your application code or deploying your code that uses the Web PubSub service.

    you can install the Azure Web PubSub client library in your Visual Studio project

    Get the connection string for your Azure Web PubSub instance from the Azure portal.

    ans you need to integrated SDK to you code as follows

    
    WebPubSubClient client = new WebPubSubClient(connectionString);  
    
    // Publish a message to a hub 
    await client.SendToAllAsync("myHub", "Hello, everyone!");    
    
    // Publish to a specific group  
    await client.SendToGroupAsync("myHub", "group1", "Targeted message");   
    
    

0 additional answers

Sort by: Most helpful