
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
ataraxia-services
Advanced tools
Services with RPC and events for Ataraxia.
This project provides a service layer on top of a Ataraxia network and allows nodes to easily register services and to call methods and receive events on services on other nodes.
npm install ataraxia-services
import { Services } from 'ataraxia-services';
const net = ... // setup network with at least one transport
const services = new Services(net);
services.onAvailable(service => console.log(service.id, 'is now available'));
services.onUnavailable(service => console.log(service.id, 'is no longer available'));
// Start the network
await net.start();
// Start the services on top of the network
await services.start();
// Register a service as a plain object
const handle = services.register({
id: 'service-id',
hello() {
return 'Hello world';
}
});
// Classes can be registered and created
services.register(class Test {
constructor(handle) {
this.handle = handle;
this.id = 'service-id';
}
hello() {
return 'Hello World';
}
})
// Interact with services
const service = services.get('service-id');
if(service) {
console.log('Service found', service);
// Call functions on the service
const reply = await service.hello();
}
ataraxia-services
supports emitting and listening to events. The support for
events is designed to be used via Atvik.
import { Event } from 'atvik';
class TestService {
constructor(handle) {
this.id = 'test';
this.helloEvent = new Event(this);
}
get onHello() {
// This onX method makes the event available on the service
return this.helloEvent.subscribable;
}
sayHello(message) {
// Emit an event
this.helloEvent.emit(message);
// Return a result
return 'Hello ' + message + '!';
}
}
// Register the service
services.register(TestService);
// Get the service either on the same node or another node
const service = services.get('test');
// Listen to the event
const handle = await service.onHello(message => console.log('Service emitted hello event:', message));
// Call the method to emit the event
await service.sayHello('World');
// Unsubscribe from event
await handle.unsubscribe();
FAQs
Services with RPC and events over Ataraxia mesh network
The npm package ataraxia-services receives a total of 4 weekly downloads. As such, ataraxia-services popularity was classified as not popular.
We found that ataraxia-services demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.