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 🙏

© 2025 – Pkg Stats / Ryan Hefner

wscom

v0.1.1

Published

Websocket to Serial Port proxy

Downloads

42

Readme

WSCOM serial proxy

NPM Version NPM Downloads NPM Downloads Codacy Badge

WSCOM serial port proxy for ASM80.com

Installation

The prerequisite you have to meet is a functional Node.js environment. It is not complicated, it exists for all major platforms, and you can download it here: nodejs.org. During the installation, package manager called NPM is installed too.

NPM is used for install the packages and libraries. To install WSCOM itself just run a command prompt and type:

$ npm install wscom -g

Usage

$ wscom

API

$ wscom runs a daemon (service), which establish a WebSocket server on localhost:1311. It has main entry endpoint, called _list, which provides a list of available serial ports, and endpoints for each serial port.

Get ports

After connecting to ws://localhost:1311/_list caller gets a JSON object with port names. Due to differences between name conventions in Windows and macOS/Linux, the Windows port names are mangled like /null/COM1 etc.

var getPorts = function(callback) {

    var connection = new WebSocket('ws://localhost:1311/_list');
        connection.onerror = function(e) {
            console.log("Cannot connect to wscom",e)
            alert("WSCOM is not running. Please install <a href=https://www.npmjs.com/package/wscom>WSCOM tool</a>, run it and reload this page!")

        }

    connection.onmessage = function (e) {
        ports = JSON.parse(e.data);
        connection.close();
        if (callback) callback(ports);

        for (var i=0;i<ports.length;i++) {
            var cn = ports[i].comName.replace("/null/",""); //Fix a common name
            $("#comports").append("<option value='"+ports[i].comName+"'>"+cn+"</option>");
        }
    };
}

Connect to serial port

Once you have an available serial port name, you can connect through ws://localhost:1311/_port_/_params_/_speed_.

  • port is the port URL from the list (/dev/ttyusb0 or /null/com1 etc.)
  • params is "8-N-1" now, all other connection parameters are ignored in this alpha version
  • speed is the baud speed.

So e.g. ws://localhost:1311/dev/ttyusb0/8-N-1/19200

When the connection is established, the port is open and all incoming data are sent through WebSocket message.

Sending data is a little bit complex. You can decide between two forms:

  • myConn.send(JSON.stringify({"code":10})) sends a binary code 10
  • myConn.send(JSON.stringify({"key":'A'})) sends a code 65 (=ASCII code for uppercase A)

You can set DTR and CTS signals too:

  • myConn.send(JSON.stringify({"dtr":1})) sets DTR signal to 1
  • myConn.send(JSON.stringify({"cts":1})) sets CTS signal to 1

These signals sometimes work as a RESET etc.

Close port

Closing WebSocket connection closes serial port and releases it.

Support me

paypal

More info

See https://www.uelectronics.info/category/my-projects/ for more info

or http://www.asm80.com for online IDE, based on this assembler