FluidFramework icon indicating copy to clipboard operation
FluidFramework copied to clipboard

Allow specifying path for socket connections

Open alpaix opened this issue 5 years ago • 8 comments

Enhance and normalize endpoint customization via IUrlResolver.

In our scenario, we host r11s containers along with other microservices in a k8s cluster with an nginx gateway. The requirement is to use a single public endpoint and proxy all service HTTP and WS traffic through the gateway. For instance,

https://*.azure.net/api/proxy/collab/repos/{tenantId}
https://*.azure.net/api/proxy/collab/deltas/{tenantId}/{documentId}
wss://*.azure.net/api/proxy/collab/socket.io/?documentId={documentId}&tenantId={tenantId}

Currently (as of v0.30), a URL resolver is only capable of specifying endpoints for orderer, storage and delta storage services. Where ordererUrl, in fact, can only be a base URL without a path as it's used in other places to format nested URLs, such as RouterliciousDocumentServiceFactory.

Ideal solution would be specifying a single orderer URL and let the Fluid driver infer the rest following a default convention.

Alternatively, tweak IFluidResolvedUrl to carry additional path parameter for socket connections, and fix the r11s document service factory to adhere to the same URL schema.

alpaix avatar Dec 16 '20 21:12 alpaix

Happy new year! Any feedback on this issue? Thoughts or ideas?

alpaix avatar Jan 08 '21 00:01 alpaix

@tanviraumi what are you thoughts?

curtisman avatar Jan 08 '21 16:01 curtisman

I am not sure why specifying three separate endpoints becomes an issue. We can't have just one url since storage url can be totally separate from orderer url. Delta and orderer url are also mostly disjoint. Do you want to specify any specific path to orderer url to route your socket requests?

tanviraumi avatar Jan 08 '21 20:01 tanviraumi

We need a method of specifying path in socket connection in DocumentDeltaConnection

const socket = io(
    url,
    {
        ...
        path:"/api/proxy/collab/socket.io",
        ...
    });

alpaix avatar Jan 08 '21 21:01 alpaix

I think we can add an optional property to IFluidResolvedUrl. Feel free to send a PR

tanviraumi avatar Jan 09 '21 18:01 tanviraumi

@alpaix - we should either find a way to propose a solution or close it, IMHO. Are you in position to raise a PR with proposal?

vladsud avatar May 27 '21 03:05 vladsud

Will take a look

alpaix avatar May 27 '21 19:05 alpaix

The workaround for this issue is to fork a driver that would allow customizing network endpoints and connection parameters. Will re-open if the driver approach is not sufficient.

alpaix avatar Jun 30 '21 02:06 alpaix