opject
is a specification and implementation for passing object
s through the network.
An object
is a self-contained piece of code.
The passing of the object through the network is obtained in 2 steps:
- a registered object is requested by the
opject client
from theopject server
; - the
opject client
instantiates or runs in a virtual machine the received object.
opject
has clients for
The opject server
can serve any kind of object. However, depending on the preferred language, a specific opject server
can be used for
The opject registry
grants extended functionality through a web interface. The registry can be self-hosted or cloud-hosted.
Install using
npm install @plurid/opject-client
or
yarn add @plurid/opject-client
Install the peer dependencies
@plurid/plurid-functions cross-fetch
The opject
client requires a server. The server can be self-hosted or cloud-hosted.
The simplest use-case implies registering an opject
, requiring, and running it.
import OpjectClient from '@plurid/opject-client';
const opjectClient = new OpjectClient({
url: 'http://server.address',
token: 'secret_token_obtained_from_server',
});
const opjectID = 'some-opject';
const opjectSource = `
class SomeOpject {
internal = 12;
read() {
return this.internal;
}
}
`;
const main = async () => {
const registered = await opjectClient.register(
opjectID,
opjectSource,
);
if (!registered) {
console.log('Opject not registered');
return;
}
const someOpject = await opjectClient.require(
opjectID,
);
const value = someOpject.read() // 12
}
main();
@plurid/opject-client-javascript • JavaScript
opject client
@plurid/opject-server-javascript • JavaScript
opject server
@plurid/opject-client-python • Python
opject client
@plurid/opject-server-python • Python
opject server