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
SHORT POLLING
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
REAL TIME RUBY
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
- sinatra-websocket gem
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
THE RACK INTERFACE
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
FOLDER STRUCTURE
HTTP ROUTING
HTTP CONTROLLERS
WEBSOCKET HANDLERS
NOODLES WIKI AND SOURCE CODE:
https://github.com/DamirSvrtan/noodles
SAMPLE APPLICATION SOURCE CODE:
https://github.com/DamirSvrtan/noodle-app
Copy of Ruby Framework For Bidirectional Communication with a Web Server
By Damir Svrtan
Copy of Ruby Framework For Bidirectional Communication with a Web Server
- 1,084