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

Make browser push available #324

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

erikzhang
Copy link

@erikzhang erikzhang commented Jun 16, 2024

Things to consider before you submit the PR:

  • Are tests passing locally?
  • Are the files formatted correctly?
  • Did you add unit tests?
  • Did you test your change with either the sample apps that are included in the repository or with a blank app that uses your change?

Description

  1. Add DataContractSerializer for BrowserRegistrationDescription.
  2. Add BrowserRegistrationDescription as KnownType.
  3. Add params to BrowserNotification's constructor to support pushing direct notifications.

Related PRs or issues

Closes #305, closes #314

Misc

If anyone wants to preview the changes, this nuget package is available.

@erikzhang
Copy link
Author

@erikzhang please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

@TuniDev-HUB
Copy link

not yet approved?

@AndrewTheWild
Copy link

Do you have a work example sending notification to browser?
With installing and method for sending?

@danielebanovaz
Copy link

danielebanovaz commented Sep 21, 2024

Is this supposed to work?
We're consistently getting this error:

Error: The JSON value could not be converted to Microsoft.NotificationHubs.Contracts.LegacyModels.BrowserPushSubscription. Path: $.pushChannel | LineNumber: 0 | BytePositionInLine: 487.. TrackingId:2c2348d4-64cb-4859-a6cc-93826077893b,TimeStamp:9/21/2024 2:10:21 PM +00:00\r\n at Microsoft.Azure.NotificationHubs.NotificationHubClient.SendRequestAsync(HttpRequestMessage request, String trackingId, HttpStatusCode[] successfulResponseStatuses, CancellationToken cancellationToken)\r\n at Microsoft.Azure.NotificationHubs.NotificationHubClient.SendRequestAsync(HttpRequestMessage request, String trackingId, HttpStatusCode successfulResponseStatus, CancellationToken cancellationToken)\r\n at Microsoft.Azure.NotificationHubs.NotificationHubClient.<>c__DisplayClass91_0.<<CreateOrUpdateInstallationAsync>b__0>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n at Microsoft.Azure.NotificationHubs.NotificationHubRetryPolicy.RunOperation[T](Func``2 operation, CancellationToken cancellationToken)\r\n at Microsoft.Azure.NotificationHubs.NotificationHubRetryPolicy.RunOperation[T](Func``2 operation, CancellationToken cancellationToken)\r\n at Microsoft.Azure.NotificationHubs.NotificationHubClient.CreateOrUpdateInstallationAsync(Installation installation, CancellationToken cancellationToken)\r\n

@msbuildnet
Copy link

Is this supposed to work? We're consistently getting this error:

Error: The JSON value could not be converted to Microsoft.NotificationHubs.Contracts.LegacyModels.BrowserPushSubscription. Path: $.pushChannel | LineNumber: 0 | BytePositionInLine: 487.. TrackingId:2c2348d4-64cb-4859-a6cc-93826077893b,TimeStamp:9/21/2024 2:10:21 PM +00:00\r\n at Microsoft.Azure.NotificationHubs.NotificationHubClient.SendRequestAsync(HttpRequestMessage request, String trackingId, HttpStatusCode[] successfulResponseStatuses, CancellationToken cancellationToken)\r\n at Microsoft.Azure.NotificationHubs.NotificationHubClient.SendRequestAsync(HttpRequestMessage request, String trackingId, HttpStatusCode successfulResponseStatus, CancellationToken cancellationToken)\r\n at Microsoft.Azure.NotificationHubs.NotificationHubClient.<>c__DisplayClass91_0.<<CreateOrUpdateInstallationAsync>b__0>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n at Microsoft.Azure.NotificationHubs.NotificationHubRetryPolicy.RunOperation[T](Func2 operation, CancellationToken cancellationToken)\r\n at Microsoft.Azure.NotificationHubs.NotificationHubRetryPolicy.RunOperation[T](Func2 operation, CancellationToken cancellationToken)\r\n at Microsoft.Azure.NotificationHubs.NotificationHubClient.CreateOrUpdateInstallationAsync(Installation installation, CancellationToken cancellationToken)\r\n

Same error on my side ...

@microsoft : do your f*** job !

@danielebanovaz
Copy link

Is this supposed to work? We're consistently getting this error:
Error: The JSON value could not be converted to Microsoft.NotificationHubs.Contracts.LegacyModels.BrowserPushSubscription. Path: $.pushChannel | LineNumber: 0 | BytePositionInLine: 487.. TrackingId:2c2348d4-64cb-4859-a6cc-93826077893b,TimeStamp:9/21/2024 2:10:21 PM +00:00\r\n at Microsoft.Azure.NotificationHubs.NotificationHubClient.SendRequestAsync(HttpRequestMessage request, String trackingId, HttpStatusCode[] successfulResponseStatuses, CancellationToken cancellationToken)\r\n at Microsoft.Azure.NotificationHubs.NotificationHubClient.SendRequestAsync(HttpRequestMessage request, String trackingId, HttpStatusCode successfulResponseStatus, CancellationToken cancellationToken)\r\n at Microsoft.Azure.NotificationHubs.NotificationHubClient.<>c__DisplayClass91_0.<<CreateOrUpdateInstallationAsync>b__0>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n at Microsoft.Azure.NotificationHubs.NotificationHubRetryPolicy.RunOperation[T](Func2 operation, CancellationToken cancellationToken)\r\n at Microsoft.Azure.NotificationHubs.NotificationHubRetryPolicy.RunOperation[T](Func2 operation, CancellationToken cancellationToken)\r\n at Microsoft.Azure.NotificationHubs.NotificationHubClient.CreateOrUpdateInstallationAsync(Installation installation, CancellationToken cancellationToken)\r\n

Same error on my side ...

@microsoft : do your f*** job !

I posted a question on Stack Overflow and got an answer:

https://stackoverflow.com/q/79010204/1737091

I already gave up and wrote my own alternative to Notification Hubs, so I didn't try it, but maybe you can find it helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants