Noodles - A BIDIRECTIONAL Ruby Framework 




Damir Svrtan



SECTIONS:


1. Real Time Web Communication
2. Real Time Ruby
3. The Rack Interface
4. Building a Ruby Web Framework
5. The Future


WHAT IS Real Time Web COMMUNICATION?

AJAX & POLLING TECHNIQUES

LONG POLLING

SHORT POLLING



HTML 5


SERVER SENT EVENTS &

WEBSOCKETS


SERVER SENT EVENTS(SSE)


WEBSOCKETS


WHY USE SSE OVER WEBSOCKETS?


  • data only needs to be streamed to the client
  • using plain HTTP, don't need a special protocol
  • automatic reconnection



REAL TIME RUBY



EVENTMACHINE

Ruby library for building asynchronous, event driven applications


EVENTMACHINE LOOP




FAYE

  • publish-subscribe messaging system
  • most used real time library in Ruby
  • client and server side libraries in Ruby and Node.js


Ruby on RAILS


  • Out of box SSE via ActionController::Live
  • WebSockets via WebSocket-Rails


SINATRA

  • built in streaming option

  • sinatra-websocket gem


GOLIATH

  • bare-metal asynchronous web server framework
  • used for high traffic API's
  • not a replacement for Rails or Sinatra

CRAMP

  • asynchronous real-time web application framework
  • async crossover between Rails and Sinatra



THE RACK INTERFACE

RACK REQUEST HASH

HELLO WORLD WITH RACK


run MyApp.new

require 'rack'

class MyApp
def call(env)
[200, {'Content-Type' => 'text/html'}, ['Hello World']]
end
end


EXPERIMENTAL REAL TIME MVC RUBY WEB FRAMEWORK



EXTERNAL ARCHITECTURE


RACK MIDDLEWARE



INTERCEPTING AND MODIFYING 
REQUESTS AND RESPONSES

NOODLES RACK MIDDLEWARE




OUT OF BOX WEBSOCKET AND 

HTTP PROTOCOL SUPPORT

INTERNAL ARCHITECTURE

Command Line


New application generator:
noodles new [APP_NAME]

Interactive console powered by Pry:
noodles console

Server starting:
noodles start

FOLDER STRUCTURE



HTTP ROUTING



HTTP CONTROLLERS


 

WEBSOCKET HANDLERS





Example APPLICATION




FURther development of NOODLES?


NOODLES WIKI AND SOURCE CODE:

https://github.com/DamirSvrtan/noodles


SAMPLE APPLICATION SOURCE CODE:

https://github.com/DamirSvrtan/noodle-app


FUTURE OF REAL TIME RUBY?

  • Lack of Rails/Sinatra core team efforts
  • Waiting for the Rack 2.0 specification

Bidirectional Ruby Framework

By Damir Svrtan

Bidirectional Ruby Framework

  • 586
Loading comments...

More from Damir Svrtan