1
1
> This is a fork of [ y-redis@be833ff] ( https://github.com/yjs/y-redis/tree/be833ff1ccea630fbc45097cc3d122cc8a690733 ) with [ y-socket.io] ( https://github.com/ivan-topp/y-socket.io ) connection layer
2
2
3
+ ## Installation
4
+
5
+ ``` sh
6
+ npm install @hackmd/y-socketio-redis
7
+ ```
8
+
9
+ ## Usage
10
+
11
+ Server side:
12
+
13
+ ``` js
14
+ import { createYSocketIOServer , createWorker } from ' @hackmd/y-socketio-redis'
15
+ ```
16
+
17
+ Client side:
18
+
19
+ ``` js
20
+ import { SocketIOProvider } from ' @hackmd/y-socketio-redis/client'
21
+ ```
22
+
3
23
---
4
24
5
- # y-redis :tophat :
25
+ # y-redis :tophat :
26
+
6
27
> y-websocket compatible backend using Redis for scalability. ** This is beta
7
28
> software!**
8
29
9
30
y-redis is an alternative backend for y-websocket. It only requires a redis
10
- instance and a storage provider (S3 or Postgres-compatible).
11
-
12
- * ** Memory efficient:** The server doesn't maintain a Y.Doc in-memory. It
13
- streams updates through redis. The Yjs document is only loaded to memory for the
14
- initial sync.
15
- * ** Scalable:** You can start as many y-redis instances as you want to handle
16
- a fluctuating number of clients. No coordination is needed.
17
- - ** Auth:** y-redis works together with your existing infrastructure to
18
- authenticate clients and check whether a client has read-only / read-write
19
- access to a document.
20
- - ** Database agnostic:** You can persist documents in S3-compatible backends, in
21
- Postgres, or implement your own storage provider.
31
+ instance and a storage provider (S3 or Postgres-compatible).
32
+
33
+ - ** Memory efficient:** The server doesn't maintain a Y.Doc in-memory. It
34
+ streams updates through redis. The Yjs document is only loaded to memory for the
35
+ initial sync.
36
+ - ** Scalable:** You can start as many y-redis instances as you want to handle
37
+ a fluctuating number of clients. No coordination is needed.
38
+
39
+ * ** Auth:** y-redis works together with your existing infrastructure to
40
+ authenticate clients and check whether a client has read-only / read-write
41
+ access to a document.
42
+ * ** Database agnostic:** You can persist documents in S3-compatible backends, in
43
+ Postgres, or implement your own storage provider.
22
44
23
45
### Components
24
46
@@ -40,7 +62,7 @@ stored redis and in the persistent storage (e.g. S3 or Postgres) for the initial
40
62
sync. After the initial sync, the server doesn't keep any Yjs state in-memory.
41
63
You can start as many server components as you need. It makes sense to put the
42
64
server component behind a loadbalancer, which can potentially auto-scale the
43
- server component based on CPU or network usage.
65
+ server component based on CPU or network usage.
44
66
45
67
The separate y-redis ** worker component** (` /bin/worker.js ` ) is responsible for
46
68
extracting data from the redis cache to a persistent database like S3 or
@@ -153,7 +175,7 @@ docker run -p 6379:6379 redis
153
175
154
176
Setup an S3-compatible store at your favorite cloud provider.
155
177
156
- Alternatively, simply run a * minio * store as a docker container:
178
+ Alternatively, simply run a _ minio _ store as a docker container:
157
179
158
180
``` sh
159
181
docker run -p 9000:9000 -p 9001:9001 quay.io/minio/minio server /data --console-address \" :9001\"
0 commit comments