Skip to content

[ExposedThing] Not possible to handle event subscriptions in Scripting level #210

@egekorkan

Description

@egekorkan

Coming from this issue in node-wot.

Use case: A reverse proxy implementation consumes a physical Thing in a local network and reexposes it as a new virtual ExposedThing to another network. A consumer of the virtual ExposedThing subscribes to an event. The issue is that there is no way to detect and handle a new subscription so that the proxy can subscribe to the event in the physical Thing. A non-optimal solution is to subscribe to the events of the physical Thing in the beginning (without any subscription) and reemit them when the events come to the proxy.

Proposal: Create two new methods in the ExposedThing interface, one to handle the subscription and one to handle unsubscription. These could be similar to setPropertyReadHandler. Example:

  • setEventSubscribeHandler(eventName, ? subscriptionPayload, ? subscriptionCount): This could also solve the handling of subscription payloads. A subscription count would be interesting if the implementation wants to limit the number of subscriptions due to resource constraints.
  • setEventUnsubscribeHandler(eventName, ? cancellationPayload, ? subscriptionCount): Similar to the above

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions