Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
js
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

beaver

Client-side library to collect a real-time stream of events from reelyActive APIs. beaver.js will collect a data stream of who/what is where/how from a server (ex: hlc-server), making this real-time information available to the web application.

Installation

beaver.js is written in vanilla JavaScript and the file can simply be included among the scripts in an HTML file. For example:

<html>
  <head></head>
  <body>
    <script src="js/beaver.js"></script>
    <script src="js/app.js"></script>
  </body>
</html>

Hello beaver

Include in your js/app.js the following code:

beaver.on('raddec', function(raddec) {
  console.log(raddec);
});

This will log to the console each raddec received by beaver.js. In this example, no raddec events will occur until beaver.js is provide a stream of such events, as described next.

Beavers love streams!

beaver.js can listen to any source of raddec events.

socket.io stream

Include the socket.io library in the HTML file:

<html>
  <head></head>
  <body>
    <script src="js/socket.io.slim.js"></script>
    <script src="js/beaver.js"></script>
    <script src="js/app.js"></script>
  </body>
</html>

Add a connection to the socket.io stream for beaver in the JavaScript app:

let socket = io.connect('http://localhost:3001');
beaver.listen(socket);

For a source of test data, run the barnacles socket.io example.

beaver logo

What's in a name?

After humans, beavers are the animals with the greatest impact on their ecosystem. Industrious and ingenious hydrological engineers, beavers build dams, filling the ponds which provide them food and protection. In turn, these basins of water provide food and habitat for diverse fauna and flora, contributing to a thriving ecosystem.

Introduced to the web browser habitat in 2016, beaver.js has adapted to fill ponds in your computer’s memory, collecting the steady stream of real-time events from an upstream source. In turn, this pool of data provides a staple food for other client-side Javascript species such as the occasional migratory cormorant.js.

Oh yeah, and the beaver is the national animal of Canada eh? And the oversized rodent is currently celebrating its 40th anniversary as the mascot of the 1976 Olympics of our native Montreal. We wood be dammed not to chews it as a mascot!

Don’t like our punny ending? Why not lodge a complaint?

What's next?

bever.js v1.0.0 was released in July 2019, superseding all earlier versions, the latest of which remains available in the release-0.1 branch.

License

MIT License

Copyright (c) 2016-2020 reelyActive

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Client-side library to collect a real-time stream of events from reelyActive APIs. We believe in an open Internet of Things.

Topics

Resources

License

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.