# ActionCable & WebSockets (Ruby on Rails) > リアルタイム機能、channels、subscriptions、broadcasting、cable.yml の設定、Redis アダプター - 18 面接問題 - Mid-Level - [面接問題: Ruby on Rails](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions.md) ## 1. Ruby on Rails における ActionCable とは何ですか? **回答** ActionCable は Rails に組み込まれたフレームワークで、WebSockets を通じてリアルタイム機能を実装できます。ブラウザとサーバー間で永続的な双方向接続を確立するために、サーバー側は Ruby、クライアント側は JavaScript の抽象化を提供します。ActionCable は Rails アプリケーションの他の部分と自然に統合され、models やその他のコンポーネントへのアクセスを可能にします。 ## 2. ActionCable が pub/sub に使用するアダプターを定義する設定ファイルはどれですか? **回答** config/ にある cable.yml ファイルは、ActionCable が使用する pub/sub アダプターを定義します。このファイルは環境ごとに異なるアダプターを指定します。開発環境には async(インメモリ、単一プロセス)、本番環境には redis または postgresql(複数のプロセス/サーバー間の通信を可能にする)。設定には通常、Redis サーバーの URL と使用するチャンネルが含まれます。 ## 3. ActionCable のサーバー側 channel は通常どのディレクトリに配置されますか? **回答** ActionCable のサーバー側 channel は app/channels/ に配置されます。このディレクトリには ApplicationCable::Connection(接続管理と認証)と ApplicationCable::Channel(すべての channel の基底クラス)が含まれます。カスタム channel は ApplicationCable::Channel を継承し、各種リアルタイム通信のビジネスロジックを定義します。 ## さらに15問利用可能 - 文字列で識別されるメッセージストリームを購読するために channel 内で使用するメソッドはどれですか? - ActionCable における stream_from と stream_for の違いは何ですか? 無料で登録: https://sharpskill.dev/ja/login ## その他のRuby on Rails面接トピック - [Rubyの基礎](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/ruby-basics.md): 25問, Junior - [Rubyのオブジェクト指向プログラミング](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/ruby-oop.md): 20問, Junior - [Rails の基礎](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/rails-fundamentals.md): 18問, Junior - [Routing & Controllers](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/routing-controllers.md): 22問, Junior - [ActiveRecord の基礎](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/active-record-basics.md): 25問, Junior - [Views と ERB テンプレート](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/views-erb-templates.md): 20問, Junior - [ActiveRecord の関連付け](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/active-record-associations.md): 24問, Mid-Level - [高度なActiveRecordクエリ](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/active-record-queries.md): 28問, Mid-Level - [Rails フォーム](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/rails-forms.md): 20問, Mid-Level - [認証と認可](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/authentication-authorization.md): 22問, Mid-Level - [モダンな Asset Pipeline とフロントエンド](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/rails-asset-pipeline.md): 18問, Mid-Level - [Rails APIモード](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/rails-api-mode.md): 20問, Mid-Level - [RSpecによるテスト](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/rails-testing-rspec.md): 24問, Mid-Level - [ActiveJob & Background Jobs](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/active-job-background-jobs.md): 20問, Mid-Level - [ActionMailer](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/action-mailer.md): 18問, Mid-Level - [ActiveStorage](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/active-storage.md): 20問, Mid-Level - [キャッシュ戦略](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/caching-strategies.md): 20問, Mid-Level - [高度なマイグレーション](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/database-migrations-advanced.md): 20問, Mid-Level - [Rails Engines とモジュラーアプリ](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/rails-engines-modular-apps.md): 18問, Senior - [パフォーマンス最適化](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/performance-optimization.md): 26問, Senior - [Rails のデザインパターン](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/rails-design-patterns.md): 22問, Senior - [Rubyのメタプログラミング](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/ruby-metaprogramming.md): 20問, Senior - [Rails のセキュリティ](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/rails-security.md): 22問, Senior - [Rails での GraphQL](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/graphql-rails.md): 20問, Senior - [デプロイと本番環境](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/rails-deployment-production.md): 20問, Senior - [Monitoring & Logging](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/monitoring-logging.md): 20問, Senior - [Rails アップグレード戦略](https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/rails-upgrade-strategies.md): 18問, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/ja/technologies/ruby-on-rails/interview-questions/action-cable-websockets