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 🙏

© 2024 – Pkg Stats / Ryan Hefner

openfire

v0.0.4

Published

Backend Server & Simple CLI tool for the OpenFire Project

Downloads

3

Readme

OpenFire Server Build Status

Server for the OpenFire Project

What is OpenFire?

OpenFire is an Open Source Database & Backend Engine. Use our JavaScript SDK to connect your web services directly to the server, and interact with your objects immediatly and realtime!

Getting started

This guide is for developers who want to get started immediatly.

Install OpenFire

npm install -g openfire

If that doesn't work, try append sudo to run installation as root.

Start hacking! This command will launch a in-memory server, with zero dependencies. Keep in mind that when you close this server the data is gone.

openfire hack

It's that simple :) Now let's put our db to work, shall we? The following example is a realtime visitor-counter, and demonstrates various functions available in the OpenFire SDK.

Create a file with a .html extension, and paste the following code. Then just open the file on a few tabs, maybe even on your mobile device and watch the counter jump!

<!DOCTYPE html>
<html>
  <title>Visitor Counter</title>
  <body>
    <h3>Welcome! There are currently &nbsp;<span id="counter"></span>&nbsp; People watching this site!</h3>
  </body>
  <script src="http://openfi.re/openfire.js"></script>
  <script>
    // Intialize our DB
    // getting-started is our namespace for this example project
    var db = new OpenFire("http://localhost:5454/getting-started");

    // connections is where we drop our users connection data in
    var connections = db.child("connections");

    // connectedChild is the unique object
    // we hold the current connection for this client in
    var connectedChild = null;

    // This function get's called every time the connections object changes.
    var connectionsChange = function(sn) {
        if (sn.val != null) {
            // Get the count
            var count = sn.childCount();

            // Set the count to our counter in HTML
            document.getElementById("counter").innerHTML = count;
        }
    };

    // Hook connectionsChange event to "value"
    // The server will call this to us each time the value of connections change.
    connections.on("value", connectionsChange);
    connections.on("connect", function() {
        // On connect, use push to create a new child inside connections
        // And set it to true to mark the connected state
        connectedChild = connections.push();
        connectedChild.set(true);

        // Use setAfterDisconnect to make sure that the value gets deleted
        // (set to null equals deletion in OpenFire)
        // to guarantee the counter only count our current visitors
        connectedChild.setAfterDisconnect(null);
    });
  </script>
</html>

As you can see it's not that hard to create fairly complex dynamic web apps with OpenFire. Currently OpenFire is in beta, and I'll try to make better documentation in the next week!

Testing

watches for file changes and reruns tests each time

  $ grunt watch

runs spec tests

  $ grunt test  

produces coverage report (needs explicit piping)

  $ grunt cov

License

GPLv2