visualweb - building a nodejs server meshwork and full-javascript stack framework

45
Building a meshwork of nodeJS servers to run a live-synced one-page WebApp

Upload: itsatony

Post on 22-Nov-2014

722 views

Category:

Technology


0 download

DESCRIPTION

A series of slides about building a one-page-webapp framework and api called VisualWeb. We run two independent services on this full-javascript stack: meinunterricht.de and mylinkcloud.com . we use nodejs, socket.io. hook.io, connect and mongodb to build hyperdynamic, desktop-like web experiences.

TRANSCRIPT

Page 1: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

Building a meshworkof nodeJS servers

to run a live-syncedone-page WebApp

Page 2: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

Who‘s talking to you here?

Toni Wagner

PhD in molecular biology

Learned Basic when computers were still breadboxes

I built solutions for my lab and ended up doing it out of my box

Page 3: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

https://meinunterricht.de

https://mylinkcloud.com

Page 4: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

Create a Desktop-Experience

Web App

Page 5: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

fast... short initial load time

no latency for user interactions

no internal page loads

live-sync

Page 6: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

reliabile... no data loss

safe passwords

safe accounting data

live-failover

Page 7: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

modular... code modules largely independent

modules distrubutable across servers

client plug & play per account type

Page 8: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

extendable...(open) API for client modules

(open) API for other clients

readable code

Page 9: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

There is nothing like that, so let‘s build it from

scratch!!!

Page 10: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

VisualWeb

Page 11: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

SERVERSCLIENT

jQuery

jQuery-Ui

socket.io

connect

mongoDB

nodeJS

doThook.io

Page 12: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

Logging

Web(api)

API

Payment

Search

MeshHook

Files DB

CLIENTS

Models&

Controllers

Page 13: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

How to run communication ????????????

between clients and servers

between clients and clients

between servers and servers

between client code modules

between server code modules

Page 14: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

 https://github.com/itsatony/bubPubSub

Page 15: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

jQuery(„#C“).trigger(„click“);

<div id=„A“><div id=„B“>

<div id=„C“></div>

</div></div>

jQuery(„#A“).bind(„click“, f(e) { alert(„yo“);});

Page 16: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

/universe/milkyway/sol/earth/europe/germany/börlin/

topicbranch

/universe/milkyway/sol//universe/milkyway/sol/earth/

/universe/milkyway/sol/earth/europe/

/universe/milkyway/sol/earth/europe/germany/

/universe/universe/milkyway/

/

Page 17: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

bubPubSub.subscribe(„/client/desktop/show/ “,function(pubData) {

announce(„Now showing desktop „ + pubData.desktop.name);},options,subscriber

);

bubPubSub.subscribe(„/client “,function(pubData) {

log(„showing desktop „ + pubData.desktop.name);},options,subscriber

);

bubPubSub.publish(„/client/desktop/show/12345678“,someData,options,publisher

);

Page 18: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

bubPubSub.subscribe(„/server “,function(pubData, pubTopic) {

socket.send(pubTopic, pubData);},options,subscriber

);

bubPubSub.subscribe(„/client “,function(pubData, pubTopic) {

socket.send(pubTopic, pubData); },options,subscriber

);

bubPubSub.publish(„/server/desktop/get/12345678“,someData,options,publisher

);

Page 19: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

but SYNC ??????

between clients on different servers

between clients on the same server

Page 20: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

bubPubSub

on top of

HOOOOOOOOOOOOOOOOOOOOOOOK.io

Page 21: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

Hook.io propagates events across connected instancesvia an event (=== simple pubSub) system.

Hook.io employs socket.io to establish connections between the connected instances.

Page 22: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

We connect all servers to the meshwork via IPv6

All server types are spawnable Ubuntu 12.04 VMs

We have a meshingNeeded Filter sitting at bubPubSub rootWe have a hook/bubPubSub adapter to determine receivers

Page 23: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

Our ChannelSystem allows event-specific syncas each Socket has specific channels for

Socket-specific messages

User-specific messages

Desktop-specific messages

Item-specific messages

UserGroup-specific messages

Page 24: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

DISCUSS PLEASE!

Page 25: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

Building a Frameworkon a

Javascript-Only Stack

Page 26: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

Create a Desktop-Experience

Web App

Page 27: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

fast... short initial load time

no latency for user interactions

no internal page loads

live-sync

Page 28: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

reliabile... no data loss

safe passwords

safe accounting data

live-failover

Page 29: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

modular... code modules largely independent

modules distrubutable across servers

client plug & play per account type

Page 30: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

extendable...(open) API for client modules

(open) API for other clients

readable code

Page 31: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

There is nothing like that, so let‘s build it from

scratch!!!

Page 32: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

VisualWeb

Page 33: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

Alright, but WhyTheF...

all in JavaScript?

Page 34: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

It‘s a lot easier to learn....

It‘s a lot easier to teach....

It‘s a lot easier to maintain....

It‘s a lot easier to extend....

Page 35: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

It‘s a lot easier to keep code quality....

It‘s a lot easier to re-use code....

It‘s a lot easier to document well....

Page 36: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

Chrome and V8 are not going away....

HTML5 & JS are here to stay.....

HTML5 is the only winner in the OS fragmentation war....

Page 37: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

Javascript has the fastest evolving interpreters...

Javascript is untyped, just like the web...

Javascript is the only language i know anything about !!!

Javascript is JSON...

Page 38: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

Why the hell should we render anything serverside?

Losing state? What‘s that good for?

Page 39: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

Dynamic is not enough! Super-Hyper-Dynamically interactive is what we want!!

Responsive layouts are a very tiny prison cell.

Page 40: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

SERVERSCLIENT

jQuery

jQuery-Ui

socket.io

connect

mongoDB

nodeJS

doThook.io

Page 41: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

We will constantly publish open-source modules.

• bubPubSub• aList• aEscalator

Up to now, we released...

Page 42: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

Soon, we will release

A fork of jQueryUI that deals with scaling for drag and drop

A fork of oAuth2 server-sided services following the standards

Page 43: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

Later, we will release

The public parts of our API to allow third-party development.Yoda, our websocket and hook.io focused load balancer.

A description for our new publishing format.

Page 44: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

Well, that‘s it for talking into the dark ..

So, why don‘t you Ask and Criticise so we can discuss a bit?

Page 45: VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Framework

Reach me via

[email protected]

@itsatony on twitter

http://about.itsatony.com

http://coffeelog.itsatony.com

I AM ON GEEKLIST

https://github.com/itsatony