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

Push#getDevicePushDetails method to make HTTP request #26

Open
ben-xD opened this issue Nov 6, 2021 · 7 comments
Open

Push#getDevicePushDetails method to make HTTP request #26

ben-xD opened this issue Nov 6, 2021 · 7 comments

Comments

@ben-xD
Copy link
Contributor

ben-xD commented Nov 6, 2021

Problem

There is currently no way to know the state from the DeviceDetails of a device unless the client has push admin capability. If clients have push admin, they can use GET rest.ably.io/push/deviceRegistrations/<deviceId>. You can find more information about that endpoint under "Get details from a registered device" at https://docs.ably.io/rest-api/. In SDKs which support receiving push notifications (aka. device activation for push notifications), it should be possible to get more information about the current device from Ably.

There are more endpoints that can be used to get this information: push/deviceRegistrations/<deviceId> (POST, PUT, PATCH, GET). Some of these do not provide a state field (it is always null), and the ones that do provide the state require push admin capability.

Solution

We should allow devices to get the full DeviceDetails about itself, without push admin.

Why? When is this useful?

Knowing the DeviceDetails, including DeviceDetails.push.state and error is useful during development and production is useful.

  • During development, a developer may wish to find out why a client is not receiving push notifications, without adjusting the capabilities of the client (i.e. adding push admin capability).
  • In production, for logging, investigation or corrective action, if a user can determine that a device registration is in failed state, they can do something about it on the device.

┆Issue is synchronized with this Jira Task by Unito

@maratal
Copy link
Collaborator

maratal commented Nov 7, 2021

More info here ably/ably-cocoa#1186

@maratal
Copy link
Collaborator

maratal commented Nov 7, 2021

@ben-xD please refer people from server team who can participate in this discussion

@paddybyers
Copy link
Member

Lets schedule a discussion on this pls

@ben-xD
Copy link
Contributor Author

ben-xD commented Nov 9, 2021

@paddybyers, @maratal and I just finished out video call.

We won't add any new endpoints, as it is possible to modify existing ones.

We should allow devices to enquire about their own device details using the same endpoint. Specifically, realtime should check if the device is looking up its own device details, then it can get: GET rest.ably.io/push/deviceRegistrations/deviceId. (where deviceId is the deviceId of that device only).

We should also allow clients to to list subscriptions by clientId and list subscriptions by deviceId if the client has authenticated with the clientId or deviceId.

I will create an issue in the internal repository for this, and update here when the feature is implemented and released.

@ben-xD ben-xD changed the title Add DeviceDetails endpoint which doesn't require Push Admin capability Push#getDevicePushDetails method to make HTTP request Nov 15, 2021
@ben-xD
Copy link
Contributor Author

ben-xD commented Nov 15, 2021

We would need to update the feature spec to document the new API implemented by Marat in ably/ably-cocoa#1186

It's relevant to all devices which can receive push notifications.

@ben-xD
Copy link
Contributor Author

ben-xD commented Nov 15, 2021

@maratal , we should be prepared that the response to the HTTP request is not a normal device registration details, and that it might contain error information. This error information (and push.state) is what we want to make available to the user.

Take a look at this:
On the notification tab in the Ably dashboard, this network request returns a push field, containing error.

{
  "id": "eb666737-1cbe-4e63-ab11-6da9b67be696",
  "appId": "vZ7jrQ",
  "clientId": "ably-flutter-example-app-android-client-id",
  "platform": "android",
  "formFactor": "phone",
  "metadata": {},
  "updateToken": "",
  "deviceSecret": "sfmvh4FXWIa4uJG9Vq/EORXbP3Jr2Fqhn5ukrZM4gp0=",
  "modified": 1636648210146,
  "push": {
    "state": "FAILED",
    "recipient": {
      "transportType": "fcm",
      "deviceId": "",
      "clientId": "",
      "registrationToken": "eG7okwEiRQKRgfosmIxHKV:APA91bGDrVCDyPqrk1Dsvm770t7gqH_1HQfhqhHIMzbjXTSmXGxnM0KorVR2Ph6-Z3nMk7NyVUIuKVTu0Rb2KnF3vzfgBNnJxmk97A2AhBtHTM1hUhgjKK1GeqVghBaLMEALHQeP5JH3",
      "deviceToken": "",
      "targetUrl": "",
      "encryptionKey": "",
      "channel": "",
      "ablyKey": "",
      "ablyUrl": ""
    },
    "error": {
      "message": "registration expired",
      "code": 41001,
      "statusCode": 410,
      "stack": "",
      "href": "",
      "nonfatal": false
    }
  }
}

Screenshot 2021-11-15 at 13 19 22

@sync-by-unito
Copy link

sync-by-unito bot commented Oct 17, 2022

➤ Automation for Jira commented:

The link to the corresponding Jira issue is https://ably.atlassian.net/browse/SDK-2766

SimonWoolf pushed a commit that referenced this issue Jan 6, 2025
[EDX-155]: Update API reference blurb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants