Skip to content

Commit 84bf526

Browse files
authored
Merge pull request #5 from hackmdio/fix/make-client-own-build
fix: separate client build
2 parents 0e83865 + 20a60a8 commit 84bf526

File tree

4 files changed

+42
-17
lines changed

4 files changed

+42
-17
lines changed

README.md

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,46 @@
11
> 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
22
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+
323
---
424

5-
# y-redis :tophat:
25+
# y-redis :tophat:
26+
627
> y-websocket compatible backend using Redis for scalability. **This is beta
728
> software!**
829
930
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.
2244

2345
### Components
2446

@@ -40,7 +62,7 @@ stored redis and in the persistent storage (e.g. S3 or Postgres) for the initial
4062
sync. After the initial sync, the server doesn't keep any Yjs state in-memory.
4163
You can start as many server components as you need. It makes sense to put the
4264
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.
4466

4567
The separate y-redis **worker component** (`/bin/worker.js`) is responsible for
4668
extracting data from the redis cache to a persistent database like S3 or
@@ -153,7 +175,7 @@ docker run -p 6379:6379 redis
153175

154176
Setup an S3-compatible store at your favorite cloud provider.
155177

156-
Alternatively, simply run a *minio* store as a docker container:
178+
Alternatively, simply run a _minio_ store as a docker container:
157179

158180
```sh
159181
docker run -p 9000:9000 -p 9001:9001 quay.io/minio/minio server /data --console-address \":9001\"

src/client/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from '../y-socket-io/client.js'

src/y-socket-io/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
export * from './client.js'
21
export * from './user.js'
32
export { YSocketIO } from './y-socket-io.js'

tsup.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { defineConfig } from 'tsup'
22

33
export default defineConfig({
4-
entryPoints: ['src/index.js'],
4+
entry: [
5+
'src/index.js',
6+
'src/client/index.js',
7+
],
58
format: ['cjs', 'esm'],
69
dts: true,
710
outDir: 'dist',

0 commit comments

Comments
 (0)