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 Additional Peer Data after Peer Connection #362

Open
wooliet opened this issue Dec 28, 2017 · 0 comments
Open

Push Additional Peer Data after Peer Connection #362

wooliet opened this issue Dec 28, 2017 · 0 comments

Comments

@wooliet
Copy link
Contributor

wooliet commented Dec 28, 2017

Feature Request

When hitting the root "cloud" instance, each server object in the returned links collection includes that server instance's custom properties.

{
  "title": "server-id",
  "rel": [
    "http://rels.zettajs.io/server"
  ],
  "href": "http://localhost:1337/servers/server-id",
  "properties": {
    "name": "server-id",
    "displayName": "detroit1"
  }
},
{
  "title": "peer-id",
  "rel": [
      "http://rels.zettajs.io/peer",
      "http://rels.zettajs.io/server"
  ],
  "href": "http://localhost:1337/servers/peer-id",
  "properties": {
    "name": "peer-id",
    "displayName": "detroit2"
  }
}

So Far

I've updated _renderRoot in lib/api_resources/root.js to include properties, which covers the root server "rel" entry.

env.response.body = {
  class: ['root'],
  links: [
    {
      rel: [rels.self],
      href: env.helpers.url.current()
    },
    {
      title: this.server._name,
      rel: [rels.server],
      href: env.helpers.url.path('/servers/' + encodeURI(this.server.id) ),
      properties: this.server.getProperties()
    },

What's Next

The data saved for each peer'd server in the registry does not include its properties. I have not been able to figure out how to push that data from the connected zetta client to the zetta "cloud" instance after a peer connection is established.

I imagined an event like "_peer/properties" sent over the connection once it's established, and again after any call to Zetta.prototype.properties. But nothing I've tried has worked.

Can you guys point me towards a possible solution?

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

1 participant