A cross browser <-> server two-way channel based on socketio
{
"source": "organic-plasma-socketio-channel/env/client",
"port": Number,
"endpoint": String
"transportChemicalsShape": Object
}
- providing
port
will instruct socketio-channel to be connected atlocalhost:${port}
- providing
endpoint
(overrides port) will instruct socketio-channel to connect at given endpoint, examplehttp://localhost:1337
transportChemicalsShape
will be used to do a deep equal match towards all chemicals emitted in plasma and those matching will be transported via the socketio channel
{
"source": "organic-plasma-socketio-channel",
"reactOnConnection": String,
"socketPropertyName": "socket",
"transportChemicalsShape": Object
}
transportChemicalsShape
will be used to do a deep equal match towards all chemicals emitted in plasma and those matching will be transported via the socketio channelreactOnConnection
indicates the type of chemical to react on which contains a reference to socketio socket instance. See organic-socketio-serversocketPropertyName
indicates the name of the property withinreactOnConnection
chemical holding reference to socketio socket instance. Defaults tosocket
. See organic-socketio-server
// server-side
plasma.emit({
type: 'MyChemical',
transportType: 'socketio',
value: 'myValue'
})
// client-side
plasma.on('MyChemical', (c) => {
console.log(c.value) // 'myValue'
})
// and vise-versa