29 lines
682 B
Markdown
29 lines
682 B
Markdown
# P2P Poll App
|
|
|
|
## Install npm packages
|
|
```
|
|
npm init -y
|
|
npm install
|
|
```
|
|
|
|
Note: the frontend obtains the packages `yjs` and `y-websocket` dynamically.
|
|
|
|
## Run backend
|
|
```
|
|
node backend.js
|
|
```
|
|
|
|
### Note on Yjs suggestion
|
|
Note that the following server setup is suggested in the Yjs docs (https://docs.yjs.dev/ecosystem/connection-provider/y-websocket):
|
|
```
|
|
npm install y-websocket-server
|
|
HOST=localhost PORT=1000 npx y-websocket
|
|
```
|
|
|
|
However, across a range of npm versions, this does not work.
|
|
Nevertheless, the essential code from the `y-websocket-server` package is used here as provided in `utils.js`.
|
|
|
|
## Run frontend
|
|
Open "frontend.html" in browser.
|
|
|