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

Improve the workflow between the WebPush adapter and other stuff #377

Open
Yoric opened this issue Apr 14, 2016 · 1 comment
Open

Improve the workflow between the WebPush adapter and other stuff #377

Yoric opened this issue Apr 14, 2016 · 1 comment

Comments

@Yoric
Copy link

Yoric commented Apr 14, 2016

If I understand correctly, for the moment, if I want to create a Recipe that sends a WebPush notification, I need to go through the following steps:

  1. Register a push subscription online, e.g. https://mozilla-services.github.io/WebPushDataTestPage/

  2. Register a push subscription on the Foxbox

{
    "select": {
        "id": "setter:[email protected]"
    },
    "value": {
        "Json": {
            "subscriptions": [
                {
                    "push_uri": "https://updates.push.services.mozilla.com/push/v1/gAAAAABXDpIsS-SyN3cuMTcGjUnizYkahEmsHvEWYlfFFEuSoHQWEYEvgTSyXf7jguYpvEZiclBK4CzgUv9CPbZoIJ8O4dVXnP1jFQC0Y7UoMqaT0Aut68nLbTI2w09kYsgiabe3qQIL",
                    "public_key": "BFzTzpsvbLyHmUdqSKV7NDJlsOaE8L9R7eTBf9f43XN4-EcP5BTL0SBYsHC3hsA9XarWgYP46TpLcACht-uz778"
                }
            ]
        }
    }
}
  1. Write an app using this push_uri and a key corresponding to public_key.

  2. Setup a resource (FIXME: How is the resource connected to this uri?)

{
    "select": {
        "id": "setter:[email protected]"
    },
    "value": {
        "Json": {
            "resources": [
                "res1"
            ]
        }
    }
}
  1. Write a Recipe to that sends to res1.

That's too many steps. Moreover, I do not understand (yet) what 4) is for. So I'd like to start brainstorming how we can reduce the number of steps.

Could we, for instance, merge steps 2) and 4) into a single operation along the lines of:

{
    "select": {
        "id": "setter:[email protected]"
    },
    "value": {
        "RegisterWebPushApplication": {
            "human_readable_name": "Monitoring for intruders in the bedroom",
            "push_uri": "https://updates.push.services.mozilla.com/push/v1/gAAAAABXDpIsS-SyN3cuMTcGjUnizYkahEmsHvEWYlfFFEuSoHQWEYEvgTSyXf7jguYpvEZiclBK4CzgUv9CPbZoIJ8O4dVXnP1jFQC0Y7UoMqaT0Aut68nLbTI2w09kYsgiabe3qQIL",
            "public_key": "BFzTzpsvbLyHmUdqSKV7NDJlsOaE8L9R7eTBf9f43XN4-EcP5BTL0SBYsHC3hsA9XarWgYP46TpLcACht-uz778"
        }
    }
}

this operation would create a new channel foo with kind WebPushNotification. Future Recipes would then be able to send notifications directly to foo.

Will probably want some kind of mechanism to be able to return values (in this case, channel ids) from send requests. I can add that as part of Decentralized Taxonomy, if necessary.

What do you think, @ferjm , @aosmond?

@arcturus
Copy link
Contributor

I also don't understand step 4 too much, but sure @aosmond come with an excellent idea.

Regarding the alternative proposal, just comment that we cannot as for as many registration as possible. We register for web push once, meaning one push uri, that we will need to multiplex via the messages that we send to the app.

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

No branches or pull requests

2 participants