Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
bd56a8c
add amd build
JulienMartel Oct 18, 2024
3b966b3
main file as amd
leoortizz Oct 23, 2024
9443760
yjs as local dep
leoortizz Oct 23, 2024
a795ee1
formatting from yjs, remove unused
leoortizz Nov 4, 2024
c13fe52
export Yjs from y-websocket, npm package name
leoortizz Nov 5, 2024
b1c8a3c
move more to dev dependencies as all deps are bundled
JulienMartel Nov 14, 2024
6d32d20
remove yjs as external in rollup
JulienMartel Nov 15, 2024
bec9b9e
update deps
leoortizz Dec 2, 2024
2ac1c69
export awarenessProtocol
leoortizz Dec 10, 2024
f3240dc
new version
leoortizz Dec 10, 2024
785ce48
latest version & latest changes
leoortizz Dec 10, 2024
d3653d7
force recreation of websocket connection when a ws connection is manu…
dmonad Dec 19, 2024
beca90d
2.0.5-0
dmonad Dec 19, 2024
f606f3f
always call close-event even if manually closed + switch to observablev2
dmonad Dec 19, 2024
7c3408a
2.1.0
dmonad Dec 19, 2024
bce6b28
This is the correct path i think
abdulhakim-alshanqiti Dec 30, 2024
6460a65
Merge pull request #187 from kemo-1/patch-1
dmonad Dec 30, 2024
b7db6f7
Fix comment about trailing slashes
mythmon Jan 23, 2025
62a9aa1
Merge pull request #190 from mythmon/patch-1
dmonad Jan 24, 2025
6a29fd8
transform server to a proper esm module
dmonad Apr 2, 2025
c802cc9
rip out y-websocket-server
dmonad Apr 2, 2025
bdcc05d
update deps and remove all optional dependencies
dmonad Apr 2, 2025
76619c3
3.0.0
dmonad Apr 2, 2025
0a7a818
without test in name
leoortizz Apr 25, 2025
59f4ab8
Upgrade to v3.0.0
leoortizz Apr 25, 2025
38d292e
Replace tabs with space in package.json
chalosalvador May 27, 2025
3d16a67
Upgrade to v3.0.0
chalosalvador May 27, 2025
3b78b69
Merge pull request #2 from monogramdesign/v3.0.0-amd
leoortizz May 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2019 Kevin Jahns <kevin.jahns@protonmail.com>.
Copyright (c) 2025 Kevin Jahns <kevin.jahns@protonmail.com>.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
58 changes: 16 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# y-websocket :tophat:
> WebSocket Provider for Yjs

Expand All @@ -25,8 +24,6 @@ and
as fallback).
* Supports exchange of awareness information (e.g. cursors).



## Quick Start

### Install dependencies
Expand All @@ -37,11 +34,25 @@ npm i y-websocket

### Start a y-websocket server

This repository implements a basic server that you can adopt to your specific use-case. [(source code)](./bin/)
There are multiple y-websocket compatible backends for `y-websocket`:

* [@y/websocket-server](https://github.com/yjs/y-websocket-server/)
* hocuspocus
- y-sweet
- y-redis
- ypy-websocket
- pycrdt-websocket
- [yrs-warp](https://github.com/y-crdt/yrs-warp)
- ...

Start a y-websocket server:
The fastest way to get started is to run the [@y/websocket-server](https://github.com/yjs/y-websocket-server/)
backend. This package was previously included in y-websocket and now lives in a
forkable repository.

Install and start y-websocket-server:

```sh
npm install @y/y-websocket-server
HOST=localhost PORT=1234 npx y-websocket
```

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

## Websocket Server

Start a y-websocket server:

```sh
HOST=localhost PORT=1234 npx y-websocket
```

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`.

### Websocket Server with Persistence

Persist document updates in a LevelDB database.

See [LevelDB Persistence](https://github.com/yjs/y-leveldb) for more info.

```sh
HOST=localhost PORT=1234 YPERSISTENCE=./dbDir node ./node_modules/y-websocket/bin/server.js
```

### Websocket Server with HTTP callback

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.

Can take the following ENV variables:

* `CALLBACK_URL` : Callback server URL
* `CALLBACK_DEBOUNCE_WAIT` : Debounce time between callbacks (in ms). Defaults to 2000 ms
* `CALLBACK_DEBOUNCE_MAXWAIT` : Maximum time to wait before callback. Defaults to 10 seconds
* `CALLBACK_TIMEOUT` : Timeout for the HTTP call. Defaults to 5 seconds
* `CALLBACK_OBJECTS` : JSON of shared objects to get data (`'{"SHARED_OBJECT_NAME":"SHARED_OBJECT_TYPE}'`)

```sh
CALLBACK_URL=http://localhost:3000/ CALLBACK_OBJECTS='{"prosemirror":"XmlFragment"}' npm start
```
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.

## License

[The MIT License](./LICENSE) © Kevin Jahns
77 changes: 0 additions & 77 deletions bin/callback.cjs

This file was deleted.

31 changes: 0 additions & 31 deletions bin/server.cjs

This file was deleted.

Loading