How to use the @finos/perspective.WebSocketServer function in @finos/perspective

To help you get started, we’ve selected a few @finos/perspective examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github finos / perspective / packages / perspective-test / src / js / index.js View on Github external
beforeAll(() => {
        if (test_root === "") {
            throw "ERROR";
        }
        server = new WebSocketServer({
            assets: paths || [path.join(test_root, "dist", "umd")],
            port: 0,
            on_start: () => {
                __PORT__ = server._server.address().port;
            }
        });
    });
github finos / perspective / examples / remote / server.js View on Github external
await populate_cache();
    const tbl = perspective.table(newRows(TABLE_SIZE), {limit: TABLE_SIZE});
    host.host_view("data_source_one", tbl.view());
    (function postRow() {
        const entry = __CACHE__[Math.floor(Math.random() * __CACHE__.length)];
        tbl.update(entry);
        setTimeout(postRow, TICK_RATE);
    })();
}

/*******************************************************************************
 *
 * Main
 */

const host = new perspective.WebSocketServer({assets: [__dirname]});

if (CACHE_INPUT) {
    init_cached();
} else {
    init_dynamic();
}
github finos / perspective / packages / perspective-cli / src / js / index.js View on Github external
async function host(filename, options) {
    let files = [path.join(__dirname, "html")];
    if (options.assets) {
        files = [options.assets, ...files];
    }
    const server = new WebSocketServer({assets: files, port: options.port});
    let file;
    if (filename) {
        file = table(fs.readFileSync(filename).toString());
    } else {
        file = await read_stdin();
    }
    server.host_table("data_source_one", file);
    if (options.open) {
        open_browser(options.port);
    }
}