Skip to content

Commit c802cc9

Browse files
committed
rip out y-websocket-server
1 parent 6a29fd8 commit c802cc9

9 files changed

+27
-854
lines changed

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2019 Kevin Jahns <[email protected]>.
3+
Copyright (c) 2025 Kevin Jahns <[email protected]>.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+16-42
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# y-websocket :tophat:
32
> WebSocket Provider for Yjs
43
@@ -25,8 +24,6 @@ and
2524
as fallback).
2625
* Supports exchange of awareness information (e.g. cursors).
2726

28-
29-
3027
## Quick Start
3128

3229
### Install dependencies
@@ -37,11 +34,25 @@ npm i y-websocket
3734

3835
### Start a y-websocket server
3936

40-
This repository implements a basic server that you can adopt to your specific use-case. [(source code)](./bin/)
37+
There are multiple y-websocket compatible backends for `y-websocket`:
38+
39+
* [@y/websocket-server](https://github.com/yjs/y-websocket-server/)
40+
* hocuspocus
41+
- y-sweet
42+
- y-redis
43+
- ypy-websocket
44+
- pycrdt-websocket
45+
- [yrs-warp](https://github.com/y-crdt/yrs-warp)
46+
- ...
4147

42-
Start a y-websocket server:
48+
The fastest way to get started is to run the [@y/websocket-server](https://github.com/yjs/y-websocket-server/)
49+
backend. This package was previously included in y-websocket and now lives in a
50+
forkable repository.
51+
52+
Install and start y-websocket-server:
4353

4454
```sh
55+
npm install @y/y-websocket-server
4556
HOST=localhost PORT=1234 npx y-websocket
4657
```
4758

@@ -126,43 +137,6 @@ wsOpts = {
126137
<dd>Fires when the underlying websocket connection closes with an error. It forwards the websocket event to this event handler.</dd>
127138
</dl>
128139

129-
## Websocket Server
130-
131-
Start a y-websocket server:
132-
133-
```sh
134-
HOST=localhost PORT=1234 npx y-websocket
135-
```
136-
137-
Since npm symlinks the `y-websocket` executable from your local `./node_modules/.bin` folder, you can simply run npx. The `PORT` environment variable already defaults to 1234, and `HOST` defaults to `localhost`.
138-
139-
### Websocket Server with Persistence
140-
141-
Persist document updates in a LevelDB database.
142-
143-
See [LevelDB Persistence](https://github.com/yjs/y-leveldb) for more info.
144-
145-
```sh
146-
HOST=localhost PORT=1234 YPERSISTENCE=./dbDir node ./node_modules/y-websocket/bin/server.cjs
147-
```
148-
149-
### Websocket Server with HTTP callback
150-
151-
Send a debounced callback to an HTTP server (`POST`) on document update. Note that this implementation doesn't implement a retry logic in case the `CALLBACK_URL` does not work.
152-
153-
Can take the following ENV variables:
154-
155-
* `CALLBACK_URL` : Callback server URL
156-
* `CALLBACK_DEBOUNCE_WAIT` : Debounce time between callbacks (in ms). Defaults to 2000 ms
157-
* `CALLBACK_DEBOUNCE_MAXWAIT` : Maximum time to wait before callback. Defaults to 10 seconds
158-
* `CALLBACK_TIMEOUT` : Timeout for the HTTP call. Defaults to 5 seconds
159-
* `CALLBACK_OBJECTS` : JSON of shared objects to get data (`'{"SHARED_OBJECT_NAME":"SHARED_OBJECT_TYPE}'`)
160-
161-
```sh
162-
CALLBACK_URL=http://localhost:3000/ CALLBACK_OBJECTS='{"prosemirror":"XmlFragment"}' npm start
163-
```
164-
This sends a debounced callback to `localhost:3000` 2 seconds after receiving an update (default `DEBOUNCE_WAIT`) with the data of an XmlFragment named `"prosemirror"` in the body.
165-
166140
## License
167141

168142
[The MIT License](./LICENSE) © Kevin Jahns

bin/callback.js

-77
This file was deleted.

bin/server.js

-31
This file was deleted.

0 commit comments

Comments
 (0)