2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【Rails】websocket-railsをスタンドアローンモードで動かす

Posted at

websocket-railsをunicornで動かすにはスタンドアローンモードじゃないとダメみたい。

WebsocketRails can now be started as a standalone server to support non-eventmachine based web servers such as Phusion Passenger or Unicorn. The standalone server requires an active Redis server to enable publishing channel events to the WebSocket server from anywhere in your application.

環境

ubuntu 14.04

redisをインストールする

スタンドアローンモードで動かすにはredisが必要なのでインストールする

sudo apt-get update
sudo apt-get -y install redis-server
redis-server --version
=> Redis server v=2.8.4

version 2.8.4が入りました

スタンドアローンモードにする

config/initializers/websocket_rails.rb
config.standalone = true
config.standalone_port = 3000 # なぜか3000じゃないと動かない
config.synchronize = false
config.redis_options = {:host => 'localhost', :port => '6379'}

起動と停止

起動

rake websocket_rails:start_server

停止

rake websocket_rails:stop_server

参考

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?