This PR adds a provider / server class to the emberplus-connection library.
Usage:
const { EmberServer } = require('emberplus-connection')
const s = new EmberServer(9000) // start server on port 9000
s.onInvocation = (emberFunction, invocation) => {
// handle function invocations
return { id: invocation.contents.invocation.id, success: true }
}
s.onSetValue = async (node, value) => {
// handle setting values
s.update(node, { value })
return true
}
s.onMatrixOperation = (matrix, connections) => {
// handle matrix operations
for (const connection of Object.values(connections)) {
s.updateMatrixConnection(matrix, connection)
}
}
const tree = {
// create a tree for the provider, see also readme
...
}
s.init(tree) // initiate the provider with the tree
This PR adds a provider / server class to the emberplus-connection library.
Usage: