-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added middleware for run Websockets with ActionCable on production
Signed-off-by: Kapil Chouhan <kpl.chouhan99@gmail.com>
- Loading branch information
1 parent
27afa30
commit d67ff32
Showing
2 changed files
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class ChatActionCable < ActionCable::Connection::WebSocket | ||
def initialize(app, options={}) | ||
@app = app | ||
end | ||
|
||
def call(env) | ||
if ::WebSocket::Driver.websocket?(env) | ||
ActionCable.server.call(env) | ||
else | ||
@app.call(env) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters