0.0.23 • Published 5 years ago
nephele-y-websocket v0.0.23
y-websocket :tophat:
WebSocket Provider for Trip Yjs
Quick Start
Install dependencies
npm i nephele-y-websocketClient Code:
import * as Y from 'yjs'
import { WebsocketProvider } from 'nephele-y-websocket'
const doc = new Y.Doc()
const wsProvider = new WebsocketProvider('ws://localhost:1234', doc)
// fetch authorized doc token, then
wsProvider.connect(docToken)
wsProvider.on('status', event => {
console.log(event.status) // logs "connected" or "disconnected"
})API
import { WebsocketProvider } from 'nephele-y-websocket'wsOpts = {
// Set this to `false` if you want to connect manually using wsProvider.connect()
connect: true,
// Specify a query-string that will be url-encoded and attached to the `serverUrl`
// I.e. params = { auth: "bearer" } will be transformed to "?auth=bearer"
params: {}, // Object<string,string>
// You may polyill the Websocket object (https://developer.mozilla.org/en-US/docs/Web/API/WebSocket).
// E.g. In nodejs, you could specify WebsocketPolyfill = require('ws')
WebsocketPolyfill: Websocket,
// Specify an existing Awareness instance - see https://github.com/yjs/y-protocols
awareness: new awarenessProtocol.Awareness(ydoc)
}0.0.23
5 years ago
0.0.20
5 years ago
0.0.21
5 years ago
0.0.22
5 years ago
0.0.17
5 years ago
0.0.18
5 years ago
0.0.19
5 years ago
0.0.10
5 years ago
0.0.11
5 years ago
0.0.12
5 years ago
0.0.13
5 years ago
0.0.14
5 years ago
0.0.15
5 years ago
0.0.9
5 years ago
0.0.16
5 years ago
0.0.8
5 years ago
0.0.5
5 years ago
0.0.7
5 years ago
0.0.6
5 years ago
0.0.4
5 years ago
0.0.3
5 years ago
0.0.2
5 years ago
0.0.1
5 years ago