aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/app/assets/javascripts
Commit message (Collapse)AuthorAgeFilesLines
* Allow patching polling interval logarithmic multiplierHusam Bilal2018-11-141-3/+4
|
* Convert ActionCable javascript to ES2015 modules with modern build environmentRichard Macklin2018-11-021-0/+475
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We've replaced the sprockets `//= require` directives with ES2015 imports. As a result, the ActionCable javascript can now be compiled with rollup (like ActiveStorage already is). - Rename action_cable/index.js.erb -> action_cable/index.js - Add rake task to generate a javascript module of the ActionCable::INTERNAL ruby hash This will allow us to get rid of ERB from the actioncable javascript, since it is only used to interpolate ActionCable::INTERNAL.to_json. - Import INTERNAL directly in ActionCable Connection module This is necessary to remove a load-order dependency conflict in the rollup-compiled build. Using ActionCable.INTERNAL would result in a runtime error: ``` TypeError: Cannot read property 'INTERNAL' of undefined ``` because ActionCable.INTERNAL is not set before the Connection module is executed. All other ActionCable.* references are executed inside of the body of a function, so there is no load-order dependency there. - Add eslint and eslint-plugin-import devDependencies to actioncable These will be used to add a linting setup to actioncable like the one in activestorage. - Add .eslintrc to actioncable This lint configuration was copied from activestorage - Add lint script to actioncable This is the same as the lint script in activestorage - Add babel-core, babel-plugin-external-helpers, and babel-preset-env devDependencies to actioncable These will be used to add ES2015 transpilation support to actioncable like we have in activestorage. - Add .babelrc to actioncable This configuration was copied from activestorage - Enable loose mode in ActionCable's babel config This generates a smaller bundle when compiled - Add rollup devDependencies to actioncable These will be used to add a modern build pipeline to actioncable like the one in activestorage. - Add rollup config to actioncable This is essentially the same as the rollup config from activestorage - Add prebuild and build scripts to actioncable package These scripts were copied from activestorage - Invoke code generation task as part of actioncable's prebuild script This will guarantee that the action_cable/internal.js module is available at build time (which is important, because two other modules now depend on it). - Update actioncable package to reference the rollup-compiled files Now that we have a fully functional rollup pipeline in actioncable, we can use the compiled output in our npm package. - Remove build section from ActionCable blade config Now that rollup is responsible for building ActionCable, we can remove that responsibility from Blade. - Remove assets:compile and assets:verify tasks from ActionCable Now that we've added a compiled ActionCable bundle to version control, we don't need to compile and verify it at publish-time. (We're following the pattern set in ActiveStorage.) - Include compiled ActionCable javascript bundle in published gem This is necessary to maintain support for depending on the ActionCable javascript through the Sprockets asset pipeline. - Add compiled ActionCable bundle to version control This mirrors what we do in ActiveStorage, and allows ActionCable to continue to be consumed via the sprockets-based asset pipeline when using a git source instead of a published version of the gem.
* Move actioncable javascript to app/javascript and change .coffee -> .jsRichard Macklin2018-11-026-433/+0
| | | | | | | | | | | | | | | | | | | | | - Rename action_cable/*.coffee -> *.js - Move app/assets/javascripts/* -> app/javascript/* - Rename action_cable.js.erb -> action_cable/index.js.erb Renaming the extension to .js is in preparation for converting these files from coffeescript to ES2015. Moving the files to app/javascript and putting the entry point in index.js.erb changes the structure of ActionCable's javascript to match the structure of ActiveStorage's javascript. (We are doing the file moving and renaming in a separate commit to ensure that the git history of the files will be preserved - i.e. git will track these as file renames rather than unrelated file additions/deletions. In particular, git blame will still trace back to the original authorship.)
* ActionCable should not raise when a connection is already openDuncan Grazier2017-01-061-1/+1
| | | | | | | | | | | ActionCable was throwing a "Existing connection must be closed before opening" exception which was being picked up as a production issue in our error monitoring software. Since this happens pretty often on any device that allows the browser to sleep (mobile) this error was getting triggered often. This change removes the exception, but keeps logging the occurrence. We now return `false` to let the caller now that `open` failed.
* Add configuration for `WebSocket` and `logger`Jon Moss2016-05-312-2/+4
| | | | [Javan Makhmali, Jon Moss]
* Build action_cable.js with BladeJavan Makhmali2016-05-241-6/+1
|
* Publish Action Cable to NPM when we release.Jon Moss2016-05-111-0/+6
| | | | Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* Cable typo: isSupportedProtocol -> isProtocolSupportedJeremy Daer2016-04-051-1/+1
|
* Merge pull request #24224 from danielrhodes/actioncable-websocket-protocolsJeremy Daer2016-04-053-16/+50
|\ | | | | | | ActionCable protocol negotiation
| * Added protocol negotiationDaniel Rhodes2016-04-053-16/+50
| | | | | | | | | | | | | | | | | | This is primarily for backwards compatibility for when or if the protocol is changed in future versions. If the server fails to respond with an acceptable protocol, the client disconnects and disables the monitor.
* | Fix WebSocket already open log message typoJon Evans2016-03-221-1/+1
|/
* Return subscription object(s) when updating the collectionJavan Makhmali2016-03-041-3/+4
|
* Make sure ActionCable.Subscriptions#create always returns the newly created ↵Pratik Naik2016-03-041-0/+2
| | | | subscription object
* Store reference to Subscriptions instance for convenienceJavan Makhmali2016-03-031-5/+6
|
* Implicity add Subscription instance to subscriptions collectionJavan Makhmali2016-03-032-13/+12
|
* Share default mount path with client side .jsJavan Makhmali2016-03-031-1/+1
|
* Fix location of default mount path valueJavan Makhmali2016-03-031-2/+3
| | | | #getConfig was implmented as general utility for reading action-cable-* meta tags (hence the `name` argument). Introduced in 8b69f1eeba753c38364fb88136b2503480f2de1d.
* Defer starting connection monitor until a connection is openedJavan Makhmali2016-03-033-41/+52
|
* Establish WebSocket connection when first subscription is created. Fixes #24026Javan Makhmali2016-03-033-9/+10
| | | | | * More intention revealing than connecting on the first call to Connection#send * Fixes that calls to Connection#send would attempt to open a connection when the WebSocket's state is CONNECTING
* ConnectionMonitor is once again notified of disconnectDaniel Rhodes2016-03-032-0/+2
|
* Make ping into a message typeDaniel Rhodes2016-03-013-10/+7
| | | | | | | | This change makes ping into a message type, which makes the whole protocol a lot more consistent. Also fixes hacks on the client side to make this all work.
* Added welcome message type and fix test hacksDaniel Rhodes2016-03-011-0/+2
|
* Only open Action Cable connection if data is being sentJon Moss2016-02-241-1/+3
|
* Enable Action Cable routes by defaultJon Moss2016-02-241-1/+1
| | | | This also marks Action Cable routes as internal to Rails.
* Fix isAlive condition and add more loggingJavan Makhmali2016-02-231-5/+7
|
* ActionCable.logJavan Makhmali2016-02-233-14/+25
|
* Uninstall event handlers when replacing WebSocket instanceJavan Makhmali2016-02-231-0/+6
| | | | Ensures we don't get "onclose" events from a previous WebSocket that was in the "closing" state
* Connection#isAliveJavan Makhmali2016-02-231-3/+3
|
* Log ConnectionMonitor connectPratik Naik2016-02-231-0/+1
|
* Treat 'closing' state as closed.Pratik Naik2016-02-231-3/+6
| | | | | | We are seeing cases where the websockets get stuck in the 'closing' state after a tab has been in background for a while. So lets treat those websockets as closed.
* Add client-side console logging to help debug reconnect issuesJavan Makhmali2016-02-232-1/+15
|
* Wrangle the asset build into something that sounds more generalMatthew Draper2016-02-017-2/+1
|
* Improvements and reorganization of assetsJon Moss2016-01-307-0/+341