Works on Node.js!

Written   -   Previous   -   All Posts   -   Next

The API is the same as on the JVM, but now it looks good:

// Create server
var ofs = new of.server();

// Serve resources from here
ofs.addURIHandler(new of.filesystem("temp"));

// Bind to 'ws' WebSocket implementation
wss.on('connection', function(ws) {
  new of.connection(ofs, ws);
});

Resources can be loaded and updated in the same way as before on clients:

// New workspace to load resources
var workspace = new of.workspace();

// Load them from here
workspace.addURIHandler(new of.filesystem("temp"));

// Create or update resource in "./temp/helloworld"
workspace.open("/helloworld", function(err, resource) {
  resource.set("Hello World!");
});

objectfabric.js is packaged with samples here.

Written   -   Previous   -   All Posts   -   Next