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

wave.io

v1.0.3

Published

The fastest communication via WebSocket using a familiar HTTP syntax

Downloads

6

Readme

Version npmNPM Downloads

Installation

  • NPM:
$ npm install wave.io
  • CDN:
<script src="https://cdn.jsdelivr.net/wave.io/latest/wave.io.min.js"></script>
  • Download/Clone this repo and include wave.io.min.js in your project
<script src="Path/To/wave.io.min.js"></script>
  • Bower:
bower install wave.io

What's wave.io?

wave.io is a lightweight client-side, syntactic-sugar JS library that wraps the browser's WebSocket API with a familiar http-like syntax. In other words wave gives you the feeling of using the regular http functions that you love and know, and at the same time it uses WebSocket instead of HTTP to transmit the data to the server. All these gives wave some "BOOM!" performance, when it comes to send and receive data from your server (see benefits).

Quick start

At the Client: (using wave.io)

<script src="/wave.io/wave.io.min.js"></script>
<script>
    http.seturl("localhost:8080");   
    http.get("/getest", function (data) {
        console.log(data);
    });
    http.post("/postest",{wave:"Is Awesome"},function(data){
        console.log(data);
    });
</script>

Node.JS server example: (using wave.io-nodejs)

var http = require('http');
var server = http.createServer(function(req, res){ }).listen(8080);
var router = require('wave.io-server')(server);
router.post('/postest',function(req,res){
    console.log(req.data);
    res.send('Ya I Know');
});

The flow of this example:

API

http

Wave.io exposes an http object to the main scope of your application so you can use it wherever you want. This object is the core of Wave as it contains most of the well-knowen HTTP verbs (GET,POST,PUT,DELETE) in the form of functions with callbacks.

http.seturl(url:String)

The seturl function open the ws:// connection to the server in order to transmit the data you send to the server.

NOTE: In order to wave to work properly

  • You must call http.seturl() function.
  • The url string must represent a server that listening for WebSocket connections.

http.get(path:String, callback:Function)

The get function sends this JSON schema (as a string) to the server: { method: 'GET', uri: '/path-arg', data: '', reswaiter: true }

http.post(path:String, data:AnyDataType, callback:Function)

The post function sends this JSON schema (as a string) to the server: { method: 'POST', uri: '/path-arg', data: 'data-arg', reswaiter: true }

http.put(path:String, data:AnyDataType, callback:Function)

The put function sends this JSON schema (as a string) to the server: { method: 'PUT', uri: '/path-arg', data: 'data-arg', reswaiter: true }

http.delete(path:String, data:AnyDataType, callback:Function)

The delete function sends this JSON schema (as a string) to the server: { method: 'DELETE', uri: '/path-arg', data: 'data-arg', reswaiter: true }

Principals

wave.io designed to make a ws connection to the server and transmit your data in the form of a JSON schema look like this: { method: 'Method', uri: '/SomePath', data: 'SomeData', reswaiter: true }

  • method :The HTTP verb of the request (String).
  • uri :The relative path of the request (String).
  • data :The data to transmit (Any DataType).
  • reswaiter:Represent whether the callback arg is used or not (Boolean).

This means, that in order to return data to the callback on the client, wave demands that the response from the server will be the same JSON schema with the same method and uri values.

TIP: If your using Node, you might wanna take a look on wave.io-nodejs, which simplifies all the work with wave on the server side.

Benefits

As you all know HTML5 WebSocket represents a major upgrade in the history of web communications. Before WebSocket, all communication between web clients and servers relied only on HTTP. Now, dynamic data can flow freely over WebSocket connections that are persistent (always on), full duplex (simultaneously bi-directional) and blazingly fast!.

Contribute

If you wanna contribute to wave, You can help with server side module like wave.io-nodejs, which implements the principles from here, for other languages like (C#, Java, PHP, Ruby, Python, Perl). Your more then welcome to email me any time [email protected]

Credits

wave using the awesome reconnecting-websocket of joewalnes.

Don't forget a Star :) GitHub Star

License

MIT wave.io project (c)2016 Ran Cohen