Skip to content

Instantly share code, notes, and snippets.

@michalkorzawski
Last active September 5, 2022 19:54
Show Gist options
  • Save michalkorzawski/044f2c00f5fe732fbec1f6f21d1fa065 to your computer and use it in GitHub Desktop.
Save michalkorzawski/044f2c00f5fe732fbec1f6f21d1fa065 to your computer and use it in GitHub Desktop.
// app/javascript/channels/user_channel.js
import consumer from "./consumer";
import CableReady from "cable_ready";
consumer.subscriptions.create("UserChannel", {
received(data) {
if (data.cableReady) CableReady.perform(data.operations);
// Called when there's incoming data on the websocket for this channel
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment