npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dvotc-websocket-node

v1.0.4

Published

This is a sample implementation of the dvotc websocket using nodejs. This uses esm modules so make sure you have type module in your package.json

Readme

dvotc-websocket-node

This is a sample implementation of the dvotc websocket using nodejs. This uses esm modules so make sure you have type module in your package.json

Installation

npm install --save dvotc-websocket-node

Usage

The below example uses dotenv package to load environment variables. However you can pass environment variables without dotenv and it will still work.

With .env

Create a config folder and update your credentials in a .env file.

WS_URL=wss://demo.dvchain.co/websocket
#WS_URL=wss://prod-deploy.dvchain.co/websocket
API_SECRET=7d753a3324325926618b0b505e318adc
API_KEY=5650bb2a-1ecc-44a6-b0f1-2181440d51ab
import { DVOTC }  from 'dvotc-websocket-node';
import path from 'path'
import fs from 'fs'
import dotenv from 'dotenv';
import * as uuid from 'uuid';

let configPath = path.join(process.cwd(), 'config')
let configFile = configPath + '/.env';

if (fs.existsSync(configFile)) {
    console.log('Using .env file from config folder', configFile)
    dotenv.config({ path: configFile })
} 

let WS_URL = process.env['WS_URL'];
let API_KEY = process.env['API_KEY'];
let API_SECRET = process.env['API_SECRET'];

if(!WS_URL || !API_KEY || !API_SECRET) {
    console.warn("Could not load API_KEY, API_SECRET or WS_URL. Use .env file in the config directory or pass them as environment variables")
    process.exit(1);
}

let subscriptions = [];

function pricesCallback(symbol, levels) {
    // console.log(symbol, levels);
}

async function start() {
    try {
        var dvotc = new DVOTC({
            url : WS_URL,
            key : API_KEY,
            secret: API_SECRET,
        });

        await dvotc.sessionCreated();

        // let sessionUser = await dvotc.getUserInfo();
        // let userLimits = await dvotc.getUserLimits();
        let symbols = await dvotc.getAvailableSymbols();

        symbols.forEach(symbol => {
            let unsubToken = dvotc.subscribeLevels(symbol, pricesCallback);    
            subscriptions.push(unsubToken);
        });
    
        let order = await dvotc.placeOrder({ 
            "quoteId": uuid.v4(), // not required for limit orders, this should be the actuall quote id received, just sending uuid for sample to make it fail
            "orderType" : "market", //quote id is mandatory for order type market
            "side": "Sell",
            "qty": 1,
            "price": 55527.51,
            "asset": "XRP", 
            "clientTag" : "c54aca46-d166-4a98-bdc3-b3169cbba622",
            "counterAsset": "USD"
        });
        console.log("result ", result);

        let cancelStatus = await dvotc.cancelOrder(order._id);

    } catch(err) {
        console.log("Failed to palce order");
        console.error(err);
    }
}

start();