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

include code to provide options for Web-Clients to request feedback f… #295

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

kaennchenstruggle
Copy link

Feature Addition

Description

Currently there is no path for (Web) Clients to request direct feedback from a module. This PR enables clients to wait for a feedback from the module or a definable number of instances of this module.

This is achieved by introducing the mmmrc_options object into the payload. mmmrc_options currently includes the following objects:

  • wait - set to true if this feature should be enabled (mandatory)
  • responsecount - number of feedbacks to wait for until feedback is returned (optional, default: 1)
  • timeout - amount of ms to wait for all feedbacks until timeout is generated (optional, default 1000ms)

This module then sends a notification to the desired module's instances including the mmrc_options object from above, now adding a sub-object type=request and a sub-object id

The desired module responds with a sendNotification of type MMMRC_RESPONSE with a payload object response containing data to be transmitted and the object mmmrc_options now with type=response and the unchanged id.

Example code:

var dataobject={ "var1" : "value1", "var2"  : true };
this.sendNotification("MMMRC_RESPONSE", {'payload': { "response": dataobject, "mmmrc_options": { "type": "response", "id": mmmrc_options.id} }});

Once all feedbacks (see "responsecount" above) are collected or timeout has passed, this module returns data to the calling client.

Example return data:

{
  "payload": {
    "success": true,
    "responses": [
      {
        "var1" : "value_from_module_instance1",
        "var2" : true
      },{
        "var1" : "value_module_instance2",
        "var2" : true
      }
    ],
    "mmmrc_options": {
      "type": "response",
      "id": "IDlo5jkx4v154hah8oq",
      "timeout": 1000
    }
  }
}

Changelog

Requirements

none

Additional info

none, but feel free to ask :D

Copy link

This pull request has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.

@github-actions github-actions bot added the stale label Nov 24, 2023
@ezeholz ezeholz changed the base branch from master to develop November 25, 2023 04:54
@github-actions github-actions bot closed this Dec 2, 2023
@ezeholz ezeholz reopened this Dec 3, 2023
@ezeholz ezeholz removed the stale label Dec 3, 2023
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

Successfully merging this pull request may close these issues.

3 participants