Notice: file_put_contents(): Write of 283205 bytes failed with errno=28 No space left on device in /opt/frankenphp/design.onmedianet.com/app/src/Arsae/CacheManager.php on line 36

Warning: http_response_code(): Cannot set response code - headers already sent (output started at /opt/frankenphp/design.onmedianet.com/app/src/Arsae/CacheManager.php:36) in /opt/frankenphp/design.onmedianet.com/app/src/Models/Response.php on line 17

Warning: Cannot modify header information - headers already sent by (output started at /opt/frankenphp/design.onmedianet.com/app/src/Arsae/CacheManager.php:36) in /opt/frankenphp/design.onmedianet.com/app/src/Models/Response.php on line 20
GitHub - patrick-michelberger/webcdn-client: Client for a browser-based content distribution network using WebRTC
Skip to content

patrick-michelberger/webcdn-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebCDN Client

Client for a browser-based content distribution network using WebRTC

var webcdn = new WebCDN();
webcdn.init('ws://webcdn.michelberger.info:1337', function() {
  console.log("Your WebCDN is ready!");
});

Currently, we are offering a coordinator server for testing purposes at ws://webcdn.michelberger.info:1337.

Installation

$ bower install webcdn

or

$ npm install webcdn-client

API

WebCDN

Exposed by including webcdn.jsinto your project.

WebCDN()

Creates a new WebCDN client:

var webcdn = new WebCDN();

WebCDN(opts:Object)

Optionally, the first argument of the WebCDN constructor can be an options object.

The following options are supported:

  • bucketUrl String - Set the root URL for static resource hosting (optional)
  • trackGeolocation Boolean - Enable the HTML5 Geolocation API (optional)

WebCDN#init(coordinatorUrl:String [,callback:Function])

Connects to a given coordinatorUrl and fires optionally a callback function with error signature (if any).
The client is automatically a peer of the WebCDN network identified with its uuid.

webcdn.init('ws://webcdn.michelberger.info:1337', function() {
  console.log("Your WebCDN is ready!");
});

WebCDN#load(contentHash:String)

Loads a specific resource identified by a unique contentHash, explicitly.

webcdn.load('35c22d5973cb21ae0887eda12185747e7a94cd74');

Examples

To view the examples, clone the WebCDN repo and install the dependencies:

$ git clone git@github.com:pmichelberger/webcdn-client.git
$ cd webcdn-client
$ npm install

Then run grunt and visit http://localhost:8000/examples. Open the same URL via a second browser window and visit your browser network & console panel.

Tests

To run the test suite, first install the dependencies, then run grunt and visit http:localhost:8000/tests:

$ npm install && bower install
$ grunt

About

Client for a browser-based content distribution network using WebRTC

Resources

Stars

Watchers

Forks

Packages

No packages published