9.2.1 • Published 7 years ago

y-websockets-server v9.2.1

Weekly downloads
118
License
MIT
Repository
github
Last release
7 years ago

Websockets Connector for Yjs (Server)

y-websockets-server is the connection point for y-websockets-client. It saves the shared data (using the memory or the leveldb database adapter), and distributes it efficiently to all connected clients.

Instructions for y-leveldb

The memory database adapter is installed by default. If you intend to use the y-leveldb database adapter, make sure to install it first.

npm install --save y-leveldb [-g]

Global installation (easy)

  • Install package npm install -g y-websockets-server
  • Execute binary y-websockets-server [--port port] [--db db] (defaults: port = 1234, db = memory (choose either leveldb or memory)).

Yjs uses debug for logging. In order to turn on logging set the environment variable DEBUG to y*,-y:connector-message: I.e

DEBUG=y*,-y:connector-message y-websockets-server --port 1234

This is how you redirect the output to a file:

DEBUG_COLORS=0 DEBUG=y*,-y:connector-message y-websockets-server --port 1234 > log.txt

Local installation (recommended if you intend to modify y-websockets-server)

  • Set up a new project

      mkdir my-y-websockets-server && cd $_ && git init && npm init && echo "node_modules" > .gitignore
  • Install npm i --save y-websockets-server

  • Copy executable cp node_modules/y-websockets-server/src/server.js .
  • Start server node server.js

Setup with Docker

  • Clone this repository and navigate to it.
  • Build the image: docker build -t y-websockets-server .
  • Run it: docker run -it --rm -p 1234:1234 --name y-websockets-server y-websockets-server
  • Feel free to modify the port argument, e.g. to -p 1773:1234 to run it at port 1773.

Setup with Heroku

Heroku is really easy to set up, and you get a free y-websockets-server with https! Preliminarily you have to set up heroku - see this great getting started guide

  • Perform the steps from the local installation
  • Create Procfile echo "web: DEBUG=y*,-y:connector-message server.js" > Procfile
  • Specify a node environment. Add this to your package.json:

      "engines": {
        "node": "6.9.1"
      }
  • Add heroku app heroku create my-websockets-server

  • Commit & Push to heroku git add -A && git commit -am 'init' && git push heroku master
  • Start app heroku ps:scale web=1
  • Get the url for your websockes-server instance heroku info (see Web Url).
10.0.0-3

7 years ago

10.0.0-2

8 years ago

10.0.0-1

8 years ago

10.0.0-0

8 years ago

9.2.1

8 years ago

9.2.0

8 years ago

9.1.6

9 years ago

9.1.5

9 years ago

9.1.4

9 years ago

9.1.3

9 years ago

9.1.2

9 years ago

9.1.1

9 years ago

9.1.0

9 years ago

9.0.3

9 years ago

9.0.2

9 years ago

9.0.1

9 years ago

9.0.0

9 years ago

0.8.4

10 years ago

0.8.3

10 years ago

0.8.2

10 years ago

0.8.1

10 years ago

0.8.0

10 years ago

0.7.6

10 years ago

0.7.5

10 years ago

0.7.4

10 years ago

0.7.3

10 years ago

0.7.2

10 years ago