y-rb_actioncable 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -7
- data/lib/y/actioncable/sync.rb +9 -2
- data/lib/y/actioncable/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c1bd91dd64aefce65bac62b72f51bf0441e222fb5c865a45a3257addbc5f4dd
|
4
|
+
data.tar.gz: 48074bedce935ac2adabf6d4f34942bb1c2ba1f08e1d278c3004b508f1b0eedf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ecaf95ff7925f08a035e54f41290fb939f6ae40666af50d736771df103aa14b988b84cd08bbfbfa006320eac72d63f573d3afa1f172f51abcbf28c6b2a06a6c
|
7
|
+
data.tar.gz: 3a734d0f445edfc492901efe1219e72d39b9321e5e00fbe8f56a248882ff6822ab276d294dd219570d51dde8a14ee3f4baf6cb401db7adcd1790eaa4764ca0e6
|
data/README.md
CHANGED
@@ -60,13 +60,8 @@ class SyncChannel < ApplicationCable::Channel
|
|
60
60
|
include Y::Actioncable::Sync
|
61
61
|
|
62
62
|
def subscribed
|
63
|
-
|
64
|
-
|
65
|
-
integrate(message)
|
66
|
-
end
|
67
|
-
|
68
|
-
# negotiate initial state with client
|
69
|
-
initiate
|
63
|
+
# initiate sync & subscribe to updates, with optional persistence mechanism
|
64
|
+
sync_from("document-1")
|
70
65
|
end
|
71
66
|
|
72
67
|
def receive(message)
|
data/lib/y/actioncable/sync.rb
CHANGED
@@ -197,8 +197,7 @@ module Y
|
|
197
197
|
# "issue_channel:id:1"
|
198
198
|
def canonical_channel_key
|
199
199
|
@canonical_channel_key ||= begin
|
200
|
-
|
201
|
-
params_part = pairs.map do |k, v|
|
200
|
+
params_part = channel_identifier.map do |k, v|
|
202
201
|
"#{k.to_s.parameterize}-#{v.to_s.parameterize}"
|
203
202
|
end
|
204
203
|
|
@@ -257,6 +256,14 @@ module Y
|
|
257
256
|
def doc
|
258
257
|
@doc ||= Y::Doc.new
|
259
258
|
end
|
259
|
+
|
260
|
+
private
|
261
|
+
|
262
|
+
def channel_identifier
|
263
|
+
return ["test", identifier] if Rails.env.test?
|
264
|
+
|
265
|
+
JSON.parse(identifier)
|
266
|
+
end
|
260
267
|
end
|
261
268
|
end
|
262
269
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: y-rb_actioncable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hannes Moser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
requirements: []
|
99
|
-
rubygems_version: 3.4.
|
99
|
+
rubygems_version: 3.4.5
|
100
100
|
signing_key:
|
101
101
|
specification_version: 4
|
102
102
|
summary: An ActionCable companion for Y.js clients.
|