aspire icon indicating copy to clipboard operation
aspire copied to clipboard

Adding hub settings for Web PubSub

Open vicancy opened this issue 1 year ago • 2 comments

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Checklist

  • Is this feature complete?
    • [x] Yes. Ready to ship.
    • [ ] No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • [x] Yes
    • [ ] No
  • Did you add public API?
    • [x] Yes
      • If yes, did you have an API Review for it?
        • [ ] Yes
        • [ ] No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • [ ] Yes
        • [ ] No
    • [ ] No
  • Does the change make any security assumptions or guarantees?
    • [ ] Yes
      • If yes, have you done a threat model and had a security review?
        • [ ] Yes
        • [ ] No
    • [x] No
  • Does the change require an update in our Aspire docs?
    • [x] Yes
      • Link to aspire-docs issue:
    • [ ] No
Microsoft Reviewers: Open in CodeFlow

vicancy avatar Aug 29 '24 08:08 vicancy

/azp run

davidfowl avatar Sep 30 '24 18:09 davidfowl

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Sep 30 '24 18:09 azure-pipelines[bot]

I think I'd prefer to see this look more like the other resources with child resources:

var wps = builder.AddAzureWebPubSub("wps1");
var hub = builder.AddHub("chat");

var web = builder.AddProject<Projects.WebPubSubWeb>("webfrontend")
    .WithExternalHttpEndpoints()
    .WithReference(wps);

// Now only works in production since localhost is not accessible from Azure
if (builder.ExecutionContext.IsPublishMode)
{
    hub.AddEventHandler($"{web.GetEndpoint("https")}/eventhandler", systemEvents: ["connected"]);
}

davidfowl avatar Oct 10 '24 06:10 davidfowl