Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[web-pubsub] Migrate @azure/web-pubsub to new core pipeline #16010

Merged
merged 22 commits into from
Jun 28, 2021

Conversation

xirzec
Copy link
Member

@xirzec xirzec commented Jun 25, 2021

Using the updated AutoRest code generator, I have migrated the package to use CoreV2.

Along the way I figured out we had some minor promise chaining issues in core-rest-pipeline and also that Web PubSub will incorrectly return Content-Encoding: gzip for HEAD requests (despite having no response body.)

@xirzec xirzec added Client This issue points to a problem in the data-plane of the library. Web PubSub labels Jun 25, 2021
@xirzec xirzec self-assigned this Jun 25, 2021
});

it("can manage users", async () => {
// `removeUserFromAllGroups` seems to take a very long time?
it.skip("can manage users", async () => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm debugging this one, though it seems like the operation is always timing out on my test account

@@ -17,7 +17,10 @@ export function decompressResponsePolicy(): PipelinePolicy {
return {
name: decompressResponsePolicyName,
async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {
request.headers.set("Accept-Encoding", "gzip,deflate");
// HEAD requests have no body
if (request.method !== "HEAD") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there other places where a similar check could be needed? I just looked and I am not sure tbh.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at all the other supported HTTP methods and none of them had this semantic (even though ones that don't always return a body may in some cases)

Copy link
Member

@deyaaeldeen deyaaeldeen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

group(groupName: string): WebPubSubGroup;
hasConnection(connectionId: string, options?: HasConnectionOptions): Promise<boolean>;
hasGroup(groupName: string, options?: HubHasGroupOptions): Promise<boolean>;
hasPermission(connectionId: string, permission: Permission, options?: HubHasPermissionOptions): Promise<RestResponse>;
hasPermission(connectionId: string, permission: Permission, options?: HubHasPermissionOptions): Promise<void>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems an existing bug... hasPermission should return Promise<boolean>


const binaryMessage = new Uint8Array(10);
res = await client.sendToAll(binaryMessage.buffer);
assert.equal(res._response.status, 202);
await client.sendToAll(binaryMessage.buffer, { onResponse });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also update the README.md to contain a sample usage for onResponse?

@xirzec
Copy link
Member Author

xirzec commented Jun 28, 2021

@vicancy I'm going to go ahead and merge this so the core fixes get into the next core release, but I'm happy to make additional web-pubsub changes/fixes!

@xirzec xirzec merged commit 21f28dc into Azure:main Jun 28, 2021
@xirzec xirzec deleted the webPubSubCoreV2 branch June 28, 2021 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants