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

pojosync

v3.2.11

Published

syncing js objects across clients and server with socket.io

Downloads

27

Readme

Syncing POJOs between clients/browsers, and your node.js server, with socket.io

##What it does

This library allows you to keep data objects up to date between multiple clients and a server.

How it works

Once you have shared an object with Client.put(object), it (and any other objects it refers to) is assigned an ID, flattened for transport, and pushed to the server. Shared objects are then broadcast to all connected clients.

##Usage

###Server

Example use with express.js. (For alternate socket.io setups, see socket.io's How To . )

   var pojosync = require('pojosync')
     , app = express()
     , server = require('http').createServer(app)
     , io = require('socket.io').listen(server, {log:false})
     , Dataserver = new pojosync.Server(io);

###Client

(Use browserify to create a file for use in browser, then reference it with a script tag. You will also need to add:

<script src="/socket.io/socket.io.js"></script>
//io defined by socket.io.js
var pojo = require('pojosync');
var Client = new pojo.Client(io);
var flossy = { type: 'Sheep', name: 'Flossy', age: 3 };
Client.put(flossy); 

Saves flossy to the server and shares the object with other clients.

var farms = Client.list({type: 'Farm'}, optional_callback); 

farms will initially be an empty array, but will fill with data once the server has returned it.

flossy.farm = {type:'Farm', name: 'Greenacres' };
Client.put(flossy);

farms will then include the new object, and flossy will be updated on all clients.

API

Client.put

Takes an object and shares it with the server (which broadcasts it to other clients). The object can be new, or a locally updated version of an already-shared object.

Client.list

Takes an object pattern and returns an array of any objects matching that pattern. This array will be kept up to date as objects are .put.

##Storage

Currently data is simply persisted on your server as a JSON file. This is simple but has its limitations - all the data must be loaded into memory at once. It should not be difficult to add persistence to other backends, such as MongoDB.