@birdabirda
A1:
Yes, you can. but pay heed to these;
- Be careful when your modules(instances) access the resource(e.g. HTML Element, sounds, sensors,…_ The competes for the same resources would make trouble.
- You need to manage the communications with
node_helper
from your instances. Instances will share the node_helper
at same time, so your socketNotfication or resources of node_helper might have to be controlled by the session per instance.
A2:
Right. 1:M messaging channel tricks might be needed.
A3:
Your module object itself. it has many methods and members. It would be created by MM framework with the definition from your code. Then it would play its role in the MM framework.
A4:
All variables in the `Module.register(“YOURMODULE”,{ … }) will be scoped. They will not be shared unless you refer or link them to global/window scope.
A5:
You might need instance id
as payload member on using socketNotification
to catch which instance sends this socketNotification
to node_helper. Vice versa, instance id
might be also needed when node_helper sends socketNotification, to explicit which instance should be aware. Between module and node_helper unlike among modules, only simple basic data type would be transferrable, so you cannot use callback or ‘complex’ class object to make the communication easy.