Ruby on Rails

ActionCable & WebSockets

Real-time features, channels, subscriptions, broadcasting, cable.yml configuration, Redis adapter

18 preguntas de entrevista·
Mid-Level
1

What is ActionCable in Ruby on Rails?

Respuesta

ActionCable is a framework built into Rails that enables real-time features via WebSockets. It provides a server-side abstraction in Ruby and a client-side abstraction in JavaScript to establish persistent bidirectional connections between the browser and the server. ActionCable integrates naturally with the rest of the Rails application, allowing access to models and other components.

2

Which configuration file defines the adapter used by ActionCable for pub/sub?

Respuesta

The cable.yml file located in config/ defines the pub/sub adapter used by ActionCable. This file specifies different adapters per environment: async for development (in-memory, single-process), redis or postgresql for production (enabling communication across multiple processes/servers). The configuration typically includes the Redis server URL and the channel to use.

3

In which directory are ActionCable server-side channels typically placed?

Respuesta

ActionCable server-side channels are placed in app/channels/. This directory contains ApplicationCable::Connection (connection management and authentication) and ApplicationCable::Channel (base class for all channels). Custom channels inherit from ApplicationCable::Channel and define the business logic for each type of real-time communication.

4

Which method should be used in a channel to subscribe to a message stream identified by a string?

5

What is the difference between stream_from and stream_for in ActionCable?

+15 preguntas de entrevista

Domina Ruby on Rails para tu próxima entrevista

Accede a todas las preguntas, flashcards, tests técnicos, ejercicios de code review y simuladores de entrevista.

Empieza gratis