Giter Site home page Giter Site logo

viraljs's Introduction

ViralJS

ExpressJS middleware for P2P Web apps distribution

To reduce server load, latency and establish self-maintainable CDN based on your users browsers.

Join the chat at https://gitter.im/PixelsCommander/ViralJS

Installing from NPM

npm -i viraljs

How to use?

var ViralContainer = require('viraljs');
var viralContainer = new ViralContainer();
myExpressApp.use(viralContainer.middleware);

Isomorphism blurred boundaries between server and client. The only difference between them currently is server`s ability to distribute application to clients. What if we go further enabling client to do this? What if we erase boundaries between server and client completely? In this case every client which got application`s code becomes it`s distributor or carrier. And drawing the analogy with spreading microorganisms in the nature this technique perfectly matches “viral JavaScript“ naming.

Motivation

P2P content distribution allows to reduce server load and decrease network latency since peering could be setup in the way content to be delivered from the nearest peer available. For example after hitting corporative network application will be delivered inside of it using high speed internal channels without creating a load on company`s internet channel.

Normal distribution

Traditional app distribution. Server sends package many times, corporative internet channels are loaded appropriately

P2P distribution

In case of P2P distribution application hits corporative network once and then is distributed using high speed internal network. This reduces server load and corporative internet channel load

Or another case – once application got from USA to Europe it is delivered inside of European networks only without creating transatlantic traffic.

Normal distribution

It takes a lot of transatlantic trips to transmit an app when doing it in a traditional way

P2P distribution

P2P allows to reduce number of transcontinental transfers and reduce server load

By distributing application via P2P you create a self-establishing and self-evolving CDN which moves data closer to client.

Bug tracker

Have a bug? Please create an issue here on GitHub!

https://github.com/PixelsCommander/ViralJS/issues

License

MIT: http://mit-license.org/

Copyright 2015 Denis Radin aka PixelsCommander

viraljs's People

Contributors

bronzehedwick avatar gitter-badger avatar pixelscommander avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

viraljs's Issues

can not find a module 'viraljs'

After npm installing i am getting this error :

npm ERR! TypeError: Object.keys called on non-object
npm ERR! at Function.keys (native)
npm ERR! at installTargetsError (/usr/share/npm/lib/cache.js:708:24)
npm ERR! at /usr/share/npm/lib/cache.js:638:10
npm ERR! at saved (/usr/share/npm/node_modules/npm-registry-client/lib/get.js:142:7)
npm ERR! at /usr/lib/nodejs/graceful-fs/polyfills.js:133:7
npm ERR! at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-52-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "viraljs"

rfc for ViralJS?

Hi all.

1. concept

I would like to create an RFC type technical document about ViralJS.

2. why?

I would like to create an rfc about cdn p2p and I believe that ViralJS can be a good use case commented in the technical document.

3. question/feedback

What do you all think of the idea?

Is it possible to have decentralized web components with ViralJS?

Hi all.

concept

I'm studying ViralJS and it might be interesting for this use case that I'm studying for academic and non-commercial purposes. So... I would like to know if it is possible in addition to decentralizing cdn, it would be possible to decentralize the ui part as well. Is it possible to have decentralized web components with ViralJS?

For example, it's very common today to use things like block-protocol, web components to modulate the html parts. But until today I've never seen a cdn focused on block-protocol or web components. This would be interesting to provide a 100% decentralized application or program.

A good use case would be, an application that works on a blockchain, but the logic or modules part is stored on a decentralized cdn also decentralized. In this way, its interoperability is achieved from all sides from its internal and external functioning. In addition, its content is also decentralized. That is, in this hypothetical example we have 3 decentralizations: content(example:"IPFS"), internal modules(example:ViralJS), part of ui that I mentioned(example: ViralJS).

Example

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>Concept</title>
    <!-- Imports polyfill with cdn external 1 -->
    <script src="https://cdn.sample1.com/ajax/libs/webcomponents/webcomponents-lite.min.js"></script>
    <!-- Imports custom element with cdn external 2 -->
    <link rel="import" href="https://cdn.sample2.com/ajax/libs/webcomponents/hello-world.html">
</head>
<body>
    <!-- Runs custom element from cdn1, cdn2 -->
    <hello-world who="Unicorn"></hello-world>
</body>
</html>

fork from source-code: webcomponents/hello-world-polymer

question/feedback

What do you all think of the idea?

Improve P2P stability

Currently there is a big chance that establishing connection with P2P will fail because of network cnfiguration.

The issue is to research ways of how stability could be improved. Just getting a 100% stable connection on desktop + android phone from another network (wifi / 3g) is a step forward.

You may be interested in disabling forceDIrect which guarantees direct HTTP delivery if there is a timeout on P2P. Try to increase a timeout to 20 000 https://github.com/PixelsCommander/ViralJS/blob/master/src/client-scripts-templates/thin-client-template.js#L13

One more idea of possible improvement is WebRTC layer which is Socket.IO P2P for now. It could be improved, upgraded or changed.

Blank page

Hello.

Is the development still in progress or has the "for fun" already ended? 👍

I get a blank page.

1|test | Viral container socket is listening on 3030
1|test | Middleware worked
1|test | Sending real app + addition
1|test | https://test.com/: 203.570ms

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.