Ruby Framework For Bidirectional Communication with a Web Server
Author: Damir Svrtan
Mentor: Prof. Sinisa Srbljic
SECTIONS:
1. History of Real Time Web Communication
2. Real Time Ruby
3. The Rack Interface
4. Building a Ruby Web Framework
5. The Future
History of Real Time Web Communication
AJAX &
POLLING TECHNIQUES
LONG 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
EVENTMACHINE
Ruby library for building asynchronous, event driven applications
EVENTMACHINE LOOP
FAYE
- publish-subscribe messaging system
- client and server side libraries in Ruby and Node.js
- usage:
- standalone server application
- integrated middleware
Ruby on RAILS
- Out of box SSE via ActionController::Live
- WebSockets via WebSocket-Rails
SINATRA
- built in streaming option
GOLIATH
- built by Ilya Grigorik
- 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
- supported on Thin and Rainbows servers
- asynchronous crossover between Rails and Sinatra
HELLO WORLD WITH RACK
run MyApp.new
require 'rack'
class MyApp
def call(env)
[200, {'Content-Type' => 'text/html'}, ['Hello World']]
end
end
RACK REQUEST HASH
Noodles
An experimental Real Time MVC Ruby Web Framework
EXTERNAL ARCHITECTURE
OUT OF BOX WEBSOCKET AND
HTTP PROTOCOL SUPPORT
INTERNAL ARCHITECTURE
NOODLES WIKI AND SOURCE CODE:
https://github.com/DamirSvrtan/noodles
SAMPLE APPLICATION SOURCE CODE:
https://github.com/DamirSvrtan/noodle-app