ADD action cable for migrate project

This commit is contained in:
Jasder
2020-07-02 15:49:22 +08:00
parent ba79b8f4e6
commit c1a5c390f7
14 changed files with 100 additions and 11 deletions

View File

@@ -0,0 +1,13 @@
// Action Cable provides the framework to deal with WebSockets in Rails.
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
//
//= require action_cable
//= require_self
//= require_tree ./channels
(function() {
this.App || (this.App = {});
App.cable = ActionCable.createConsumer();
}).call(this);

View File

@@ -0,0 +1,13 @@
App.mirror_project = App.cable.subscriptions.create("MirrorProjectChannel", {
connected: function() {
// Called when the subscription is ready for use on the server
},
disconnected: function() {
// Called when the subscription has been terminated by the server
},
received: function(data) {
// Called when there's incoming data on the websocket for this channel
}
});