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

w3gram-server

v0.3.3

Published

W3gram Push Notification Server

Readme

W3gram Server

Deploy Build Status API Documentation NPM Version

This is a node.js server for the W3gram push notification protocol.

The server was designed to be deployed to Heroku using free resources, so it fits in a single dyno. The code has great test coverage using mocha.

Easy Setup

Click the ''Deploy to Heroku'' button at the top of this page to create your own W3gram server running on Heroku. Don't worry, the project only uses free add-ons!

Get your server's MAK and store it somewhere safely.

curl -i https://w3gram-test.herokuapp.com/mak

# Response example:
# { "mak": "G-TPkmtKOczXx203po1NblklXsK5OXUylUOGkQUxRQk" }

Create an application and note its API key and secret.

curl -i -X POST -H 'Content-Type: application/json' \
  -d '{"mak": "G-TPkmtKOczXx203po1NblklXsK5OXUylUOGkQUxRQk", "app": { "name": "Testing", "origin": "*"}}' \
  https://w3gram-test.herokuapp.com/apps

# Response example:
# {
#    "key":"uUJPS3zgIpQjDnxn",
#    "secret":"7cAXyVAYEhRbQ0UFCFI4qJAWOmXLZaPC1xX6niNIxCE",
#    "origin":"*",
#    "name":"Testing"
# }

Manual Interaction Example

Create a token for a device ID.

echo -n "device-id|my-tablet" | \
    openssl dgst -sha256 -hmac "7cAXyVAYEhRbQ0UFCFI4qJAWOmXLZaPC1xX6niNIxCE" \
    -binary | base64

# Output example:
# EVwwWmwiIfLbTDV8OWsHVc4r/p2WUpKXIJcXCdtoFxM

Register the device.

curl -i -X POST -H 'Content-Type: application/json' \
    -d '{"app": "uUJPS3zgIpQjDnxn", "device": "my-tablet", "token": "EVwwWmwiIfLbTDV8OWsHVc4r_p2WUpKXIJcXCdtoFxM"}' \
    https://w3gram-test.herokuapp.com/register

# Response example:
# {
#    "push":"https://w3gram-test.herokuapp.com/push/1.my-tablet.WMF5TISqRYYkUr5GJWunmP40FvXI1yU_Qb5kXc907TY",
#    "route":"https://w3gram-test.herokuapp.com/route/1.my-tablet.HwVTM_07vSbHzrQHCBeHeLygUuvm5esJa2yzOjwmJwQ"
# }

Do the routing step.

curl -i -X POST -H 'Content-Type: application/json' -d '{}' \
    https://w3gram-test.herokuapp.com/route/1.my-tablet.WMF5TISqRYYkUr5GJWunmP40FvXI1yU_Qb5kXc907TY

# Response example:
# {
#   "listen":"wss://w3gram-test.herokuapp.com/ws/1.my-tablet.HwVTM_07vSbHzrQHCBeHeLygUuvm5esJa2yzOjwmJwQ"
# }

Start a WebSocket connection:

wscat -c "wss://w3gram-test.herokuapp.com/ws/1.my-tablet.HwVTM_07vSbHzrQHCBeHeLygUuvm5esJa2yzOjwmJwQ"

Send a notification:

curl -i -X POST -H 'Content-Type: application/json' \
    -d '{"receiver": "1.my-tablet.WMF5TISqRYYkUr5GJWunmP40FvXI1yU_Qb5kXc907TY", "message": { "data": "Hello push world" } }' \
    https://w3gram-test.herokuapp.com/push

Development Setup

Install all dependencies and create PostgreSQL database for development and testing.

npm install
createdb w3gram_test
createdb w3gram_dev

Run the server in development mode.

PORT=3100 npm start

For development, it can be handy to create an application whose key and secret matches pre-defined values.

curl -i -X POST -H 'Content-Type: application/json' \
  -d '{"mak": "dev-mak", "app": { "name": "Testing", "origin": "*", "key": "fixed-key", "secret": "fixed-secret" }}' \
  http://localhost:3100/apps

# Response example:
# {
#    "key":"fixed-key",
#    "secret":"fixed-secret",
#    "origin":"*",
#    "name":"Testing"
# }

License

This project is Copyright (c) 2014 Victor Costan, and distributed under the MIT License.