0.5.12 • Published 9 years ago
origami2-plugin-io v0.5.12
Origami 2 plugin socket.io helper
constructor
Params:
apirequired: Plugin constructor function.privateKeyrequired: Plugin private key.dependenciesMapoptional: An object containing string keys and string values. For example:
{
"constructorParameterName": "OtherPluginName"
} A client object will be created, that client will use the same context as the plugin invoked method.
Each key like constructorParameterName will be mapped to an API proxy.
localsoptional: An object containing string keys and string values. For example:
{
"param1": 1,
"param2": "another",
"db": myDb
}eventsoptional:Each key like
param1will be set as the value on the constructor of the same name.
An additional constructor will be passed:
emitwhich receives one parameter and broadcast the event to the stack.
.connect
Returns: a Promise to be resolved once connected Params:
urlrequired: the URL to connect using a socket.io client.
It is expected the other end to be using the stack socket.io helper
.listenSocket
Returns: a Promise to be resolved once connected Params:
socketrequired: a socket to connect to. Might be an event emitter or a socket.io socket object.
It is expected the other end to be using the stack socket.io helper