about summary refs log tree commit diff
path: root/app/javascript/channels
diff options
context:
space:
mode:
authorBen Harris <ben@tilde.team>2021-08-21 19:30:19 -0400
committerBen Harris <ben@tilde.team>2021-08-21 19:30:33 -0400
commit819a3edae405227f11283ad494a7f4ca9c771467 (patch)
tree8da57ee1777f992f4f13879795916615009f6a53 /app/javascript/channels
init
Diffstat (limited to 'app/javascript/channels')
-rw-r--r--app/javascript/channels/consumer.js6
-rw-r--r--app/javascript/channels/index.js5
2 files changed, 11 insertions, 0 deletions
diff --git a/app/javascript/channels/consumer.js b/app/javascript/channels/consumer.js
new file mode 100644
index 0000000..0eceb59
--- /dev/null
+++ b/app/javascript/channels/consumer.js
@@ -0,0 +1,6 @@
+// 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.
+
+import { createConsumer } from "@rails/actioncable"
+
+export default createConsumer()
diff --git a/app/javascript/channels/index.js b/app/javascript/channels/index.js
new file mode 100644
index 0000000..0cfcf74
--- /dev/null
+++ b/app/javascript/channels/index.js
@@ -0,0 +1,5 @@
+// Load all the channels within this directory and all subdirectories.
+// Channel files must be named *_channel.js.
+
+const channels = require.context('.', true, /_channel\.js$/)
+channels.keys().forEach(channels)