ACTION CABLE
REAL-TIME RAILS ANY CABLE
• What are WebSockets?
• ActionCable
CONTENTS • ActionCable Chat Demo
• AnyCable
• AnyCable Chat Demo
HTTP AND
WEB SOCKETS
INTRODUCTION
ACTION CABLE
RailsConf 2015 April, 21
DHH - Creator of Ruby on Rails, Founder & CTO at Basecamp
ACTION CABLE SEAMLESSLY
INTEGRATES WEBSOCKETS WITH THE
REST RAILS APPLICATION.
A "FULL-STACK OFFERING": IT PROVIDES
BOTH A CLIENT-SIDE JAVASCRIPT
FRAMEWORK, AND A SERVER-SIDE RUBY
FRAMEWORK.
ACTION CABLE USES THE RACK SOCKET
HIJACKING API TO TAKE OVER CONTROL
OF CONNECTIONS FROM THE
APPLICATION SERVER. ACTION CABLE
THEN MANAGES CONNECTIONS
INTERNALLY, IN A MULTITHREADED
MANNER, LAYERING AS MANY CHANNELS
AS YOU CARE TO DEFINE OVER THAT
SOCKET CONNECTION.
IN A NUTSHELL
ActionCable: Easy configuration
PROS Application logic access through channels
JavaScript client that just works
ACTION CABLE - CHAT DEMO
• .
•
EMPIRICAL EVIDENCE
• Look in the slide notes below for topics to consider talking about
ActionCable: MemoryCable
CONS
WHY?
THE hijack PRICE - “Due to code duplication and extra work, the memory
consumption for hijack based solutions is higher and their performance is slower (more
system calls, more context switches, etc’)..” –Bo
• Long-lived objects
• Heap fragmentation
• ~
RUBY 3X3
ANYCABLE
ANYCABLE
GRPC
• gRPC is a modern open source high performance RPC framework that can run in any
environment. It can efficiently connect services in and across data centers with pluggable
support for load balancing, tracing, health checking and authentication. It is also applicable
in last mile of distributed computing to connect devices, mobile applications and
browsers to backend services.
•
ANYCABLE ACTS LIKE A BRIDGE BEETWEEN LOGIC-LESS WEBSOCKET SERVER AND ACTION
CABLE-LIKE RUBY FRAMEWORK (I.E. FRAMEWORK WHICH SUPPORT ACTION CABLE
PROTOCOL).
BENCHMARKS: ANYCABLE
ANY CABLE CHAT DEMO
MORE DOCUMENTS
• [Link]
• [Link]
[Link]
[Link]