Class: DocumentChannel

Inherits:
ApplicationCable::Channel
  • Object
show all
Includes:
Y::ActionCable
Defined in:
lib/generators/yrby/install/templates/document_channel.rb

Overview

Collaborative documents over Action Cable: one channel speaking the y-websocket protocol (sync plus presence). Storage is Y::Document + Y::DocumentUpdate; a document is created on its first change and its history goes with it when it is destroyed. Point on_load/on_change elsewhere to swap storage.

Instance Method Summary collapse

Instance Method Details

#receive(data) ⇒ Object



25
# File 'lib/generators/yrby/install/templates/document_channel.rb', line 25

def receive(data) = sync_receive(data, params[:id])

#subscribedObject



19
20
21
22
23
# File 'lib/generators/yrby/install/templates/document_channel.rb', line 19

def subscribed
  return reject unless authorized?(params[:id])

  sync_subscribed(params[:id])
end