Skip to content

TexteaInc/y-socket.io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@textea/y-socket.io

Features

  • React Enhancement like <Room/>, <SocketIOProvider/>...
  • Multi Persistence Support.
  • Customizable for each side.
  • Authentication

Usage

npm install @textea/y-socket.io
# or
yarn add @textea/y-socket.io
# or
pnpm install @textea/y-socket.io
import * as Y from 'yjs'
import { createSocketIOProvider } from '@textea/y-socket.io/provider'
const doc = new Y.Doc()

const provider = createSocketIOProvider('ws://localhost:1234', 'my-room', doc)
provider.subscribe(state => state.error, error => {
  if (error) {
    console.error('socket.io provider error', error)
  }
})

View example code with React.js

Document

LICENSE

This project is MIT licensed.