brayns
TypeScript icon, indicating that this package has built-in type declarations

0.8.0 • Public • Published

Brayns JavaScript/TypeScript Client

A JavaScript/TypeScript interface for interacting with the Brayns rendering service.

Table of Contents

Installation


You can install this package from NPM:

npm add rxjs rockets-client brayns

Or with Yarn:

yarn add rxjs rockets-client brayns

NOTE: TypeScript type definitions are bundled with the package.

Usage


Create a client and connect:

import {Client} from 'brayns';
import {take} from 'rxjs/operators';
 
const brayns = new Client('myhost');
await brayns.ready.pipe(take(1))
    .toPromise();

Listen to server notifications:

import {Client, PROGRESS} from 'brayns';
 
const brayns = new Client('myhost');
 
brayns.observe(PROGRESS)
    .subscribe(progress => {
        console.log(progress);
    });

Send notifications:

import {CANCEL, Client} from 'brayns';
 
const brayns = new Client('myhost');
await brayns.ready.pipe(take(1))
    .toPromise();
 
brayns.notify(CANCEL, {
    id: 1 // some request id
});

Make a request:

import {Client, GET_STATISTICS} from 'brayns';
 
const brayns = new Client('myhost');
await brayns.ready.pipe(take(1))
    .toPromise();
 
const statistics = await brayns.request(GET_STATISTICS);
console.log(statistics);

Upload a model:

import {Client} from 'brayns';
 
const brayns = new Client('myhost');
await brayns.ready.pipe(take(1))
    .toPromise();
 
// Usually we get the file from user input
const file = new File([]);
 
await brayns.upload({file});

/brayns/

    Package Sidebar

    Install

    npm i brayns

    Weekly Downloads

    0

    Version

    0.8.0

    License

    LGPL-3.0+

    Unpacked Size

    529 kB

    Total Files

    47

    Last publish

    Collaborators

    • rolandjitsu