You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
43
53
44
54
```sh
55
+
npm install @y/y-websocket-server
45
56
HOST=localhost PORT=1234 npx y-websocket
46
57
```
47
58
@@ -126,43 +137,6 @@ wsOpts = {
126
137
<dd>Fires when the underlying websocket connection closes with an error. It forwards the websocket event to this event handler.</dd>
127
138
</dl>
128
139
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.
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}'`)
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.
0 commit comments