New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Action Cable into master #22586

Merged
merged 513 commits into from Dec 17, 2015

Conversation

Projects
None yet
@dhh
Member

dhh commented Dec 14, 2015

Working in a branch so everyone in rails/rails can collaborate.

lsylvester and others added some commits Jul 9, 2015

Freshen Gemfile.lock
Generated from a fresh `bundle install`

* Add websocket-driver
* Update activesupport
* Rename `actioncable` -> `action_cable`
Merge pull request #7 from lsylvester/update-reame-sample-code-syntax…
…-error

Up[date README sample code so there is no syntax error
Merge pull request #8 from packagethief/singleton-server
ActionCable.server should always return the same instance
Merge pull request #10 from packagethief/doc-syntax
Fix CoffeeScript syntax in code examples
Merge pull request #11 from lsylvester/use-websocket-protocol
update documentation to use websocket protocol
Merge pull request #12 from lsylvester/application-channel-not-defined
update README to include creating the ApplicationCabel::Channel
Update README.md
Fix double ` ```ruby ` within the same code block.
Merge pull request #18 from mull/patch-1
README.md code block fix
Update readme to include requiring the cable js file and rename the e…
…xample file for creating App.cable not conflict with the action cable js libs
small typo on README.md
celluoid -> celluloid
Merge pull request #24 from lunks/patch-1
small typo on README.md
Merge pull request #25 from lsylvester/update-readme-to-remove-js
 Update README to use coffeescript  all the time

dhh and others added some commits Dec 16, 2015

Assume that the cable server is running in-process by default, offer …
…option to change that in config/environments/production.rb
Avoid Action Cable stubs on --skip-action-cable
Still missing the stuff in app/ – we need to basically switch from a *
match to specifically picking out what we need.
No need to check for puma
Rack::Server already does it work for us if the server is installed.
Don't mount the ActionCable server by default
Since we require you to enable it on the client-side, let us do the
same on the server-side. Then you’re not running an EventMachine unless
you need to.

dhh added a commit that referenced this pull request Dec 17, 2015

@dhh dhh merged commit 48f5cec into master Dec 17, 2015

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@dhh dhh deleted the merge-action-cable branch Dec 17, 2015

@rafaelfranca rafaelfranca modified the milestones: 5.0.0 [temp], 5.0.0 Dec 30, 2015

@claudiob

This comment has been minimized.

Show comment
Hide comment
@claudiob

claudiob Feb 10, 2016

Member

Hello @rafaelfranca -- I was curious about this commit. Why do we use a file called railtie.rb in every module but a file called engine.rb in Action Cable?

Based on 346a752 I thought we would simply rename action_cable/engine.rb to action_cable/railtie.rb.

Thanks!

Member

claudiob commented on 3354b2d Feb 10, 2016

Hello @rafaelfranca -- I was curious about this commit. Why do we use a file called railtie.rb in every module but a file called engine.rb in Action Cable?

Based on 346a752 I thought we would simply rename action_cable/engine.rb to action_cable/railtie.rb.

Thanks!

This comment has been minimized.

Show comment
Hide comment
@maclover7

maclover7 Feb 10, 2016

Member

Good question @claudiob - what are the differences between engines and railties? It looks like Rails::Engine just inherits from Rails::Railtie, and adds some extra functionality.

Member

maclover7 replied Feb 10, 2016

Good question @claudiob - what are the differences between engines and railties? It looks like Rails::Engine just inherits from Rails::Railtie, and adds some extra functionality.

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Feb 10, 2016

Member

The differences between Engine and Railtie are exactly the extra functionality 😄.

We can't use a Railtie for Action Cable because it includes JavaScript code. The main difference between an Engine and a Railtie is that Engines can have models, views, controller, helpers, initializers, migrations and assets. We need assets support for Action Cable.

I explained it here ff370ee

Member

rafaelfranca replied Feb 10, 2016

The differences between Engine and Railtie are exactly the extra functionality 😄.

We can't use a Railtie for Action Cable because it includes JavaScript code. The main difference between an Engine and a Railtie is that Engines can have models, views, controller, helpers, initializers, migrations and assets. We need assets support for Action Cable.

I explained it here ff370ee

@TikiTDO

This comment has been minimized.

Show comment
Hide comment
@TikiTDO

TikiTDO May 22, 2016

Is there a reason for the unless @disconnectedRecently() in the reconnectIfStale method here? I am writing my own implementation of these scripts because my requirements need more direct access to the web socket, and this is the only part that I can't see a purpose for. Any chance you could clarify the thought process here?

TikiTDO commented on c0e554c May 22, 2016

Is there a reason for the unless @disconnectedRecently() in the reconnectIfStale method here? I am writing my own implementation of these scripts because my requirements need more direct access to the web socket, and this is the only part that I can't see a purpose for. Any chance you could clarify the thought process here?

This comment has been minimized.

Show comment
Hide comment
@javan

javan May 23, 2016

Member

It's to avoid a "thundering herd" of connections when the server closes the socket. When deploying new code and restarting the server, for example. If every client immediately reconnected onclose there'd be a flood of new connections. Instead, we let ConnectionMonitor's timer detect the stale connection and reconnect, which naturally distributes the connections thanks to the randomness of when each client's timer started.

I am writing my own implementation of these scripts because my requirements need more direct access to the web socket

FYI you can access the WebSocket directly: App.cable.connection.webSocket.

Member

javan replied May 23, 2016

It's to avoid a "thundering herd" of connections when the server closes the socket. When deploying new code and restarting the server, for example. If every client immediately reconnected onclose there'd be a flood of new connections. Instead, we let ConnectionMonitor's timer detect the stale connection and reconnect, which naturally distributes the connections thanks to the randomness of when each client's timer started.

I am writing my own implementation of these scripts because my requirements need more direct access to the web socket

FYI you can access the WebSocket directly: App.cable.connection.webSocket.

This comment has been minimized.

Show comment
Hide comment
@TikiTDO

TikiTDO May 23, 2016

Ah, thank you. That makes a lot more sense.

Unfortunately just access to the socket object wouldn't be enough. My use case would need to replace all the event handlers, and inject a few callbacks in the monitor at the very least. This app is also running on a platform that has access to Promises and Proxies, which simplifies life a bit.

I can share the finish result if you're interested, thought I doubt it would be of any use outside of my application.

TikiTDO replied May 23, 2016

Ah, thank you. That makes a lot more sense.

Unfortunately just access to the socket object wouldn't be enough. My use case would need to replace all the event handlers, and inject a few callbacks in the monitor at the very least. This app is also running on a platform that has access to Promises and Proxies, which simplifies life a bit.

I can share the finish result if you're interested, thought I doubt it would be of any use outside of my application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment