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

0.0.1-alpha.11 • Public • Published

openvr2ws-client

npm (scoped)

Installation

Use npm to install the package.

npm install openvr2ws-client

Usage

TypeScript project

import {OpenVR2WS} from './OpenVR2WS';

const client = new OpenVR2WS();

// This event will return true when connected and false when disconnected.
client.OnStatus.on(async (status) => {
    if (status) {
        // Async methods will return the response.
        // These responses will not go through the message event.
        const cumulativeStats = await client.getCumulativeStatsAsync();

        console.log('cumulativeStats', cumulativeStats);
    }
});

// Any messages that don't have a nonce matching an async call will come through this event.
client.OnMessage.on((message) => {
    console.log('message', message);

});

// WARNING: Don't perform any requests inside this.
// The webSocket connection is not guaranteed to be fully ready yet.
client.init().then(async () => {
    console.log('Ready!');
});

Docs

https://jeppevinkel.github.io/openvr2ws-client

Contributing

Pull requests are welcome. For design changes, please open an issue to discuss what you would like to change.

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i openvr2ws-client

Weekly Downloads

8

Version

0.0.1-alpha.11

License

MIT

Unpacked Size

27.8 kB

Total Files

42

Last publish

Collaborators

  • jeppevinkel