gitwtfhub

wtf is y-websocket?

yankeeinlondon/y-websocket — explained in plain English

Analysis updated 2026-07-12 · repo last pushed 2021-12-30

Audience · developerComplexity · 3/5DormantSetup · moderate

TL;DR

A connector that lets multiple people work on the same document at the same time by syncing changes through a central server. Built for Yjs, it powers real-time collaboration in web apps.

Mindmap

mindmap
  root((repo))
    What it does
      Syncs changes instantly
      Shares cursor positions
      Syncs across browser tabs
    Tech stack
      WebSocket
      Yjs
      JavaScript
      Node.js
    Use cases
      Collaborative text editors
      Shared whiteboards
      Multi-user boards
    Audience
      App developers
      Builder teams
    Architecture
      Central server model
      HTTP callback for saving

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Build a Google Docs-style collaborative text editor where teammates edit the same document simultaneously.

REASON 2

Add real-time cursor presence to a shared whiteboard or canvas application.

REASON 3

Sync document state across multiple browser tabs without hitting the server.

REASON 4

Trigger server-side saves or notifications when a shared document changes using HTTP callback mode.

What's in the stack?

JavaScriptYjsWebSocketNode.js

How it stacks up

yankeeinlondon/y-websocket0verflowme/alarm-clock0xhassaan/nn-from-scratch
Stars0
LanguageCSSPython
Last pushed2021-12-302022-10-03
MaintenanceDormantDormant
Setup difficultymoderateeasymoderate
Complexity3/52/54/5
Audiencedevelopervibe coderdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · moderate Time to first run · 30min

Requires running a WebSocket server alongside your application and wiring up Yjs document instances on the client.

The license is not specified in the explanation, so it is unknown what permissions are granted.

Wtf does this do

y-websocket is a connector that lets multiple people work on the same document at the same time through a central server. It is built for Yjs, a library that handles real-time collaboration in web applications. The user-facing benefit is straightforward: when someone types, moves a cursor, or makes changes, everyone else viewing the same document sees it instantly. The project uses a classic client-server setup. Each person's browser connects to a single server using a persistent connection called a WebSocket. When someone makes a change, their browser sends it to the server, and the server forwards that update to everyone else connected to the same "room." The server also tracks awareness information, which is how it shares things like cursor positions so you can see where other people are working. If you open the same document in multiple tabs in the same browser, it syncs between tabs directly without even needing to talk to the server. This would be used by developers building collaborative editing tools, think Google Docs-style text editors, shared whiteboards, or multi-user project management boards. For example, if you are building a note-taking app and want multiple teammates to edit the same document simultaneously, this handles the plumbing of moving changes between everyone's browsers. It also supports an HTTP callback mode, which lets your server save document updates to a database or trigger other actions whenever the document changes. One notable tradeoff is that it relies on a central server rather than a peer-to-peer approach. The upside is that you can handle authentication and authorization through standard mechanisms like cookies and headers, since every connection passes through your server. The server included here is described as a basic starting point, so you would likely adapt it to fit your specific needs around user permissions, data storage, and scaling.

Yoink these prompts

Prompt 1
Set up a basic Yjs document with y-websocket so that two browser tabs editing the same text stay in sync in real time. Include the server and client code.
Prompt 2
Add awareness state to my y-websocket setup so that each connected user's cursor position is visible to everyone else in the same room.
Prompt 3
Implement HTTP callback mode in y-websocket so that every document update is persisted to a simple database, and show how to verify the callback is firing.
Prompt 4
Extend the basic y-websocket server to require a cookie-based authentication check before allowing a client to join a room and receive updates.

Frequently asked questions

wtf is y-websocket?

A connector that lets multiple people work on the same document at the same time by syncing changes through a central server. Built for Yjs, it powers real-time collaboration in web apps.

Is y-websocket actively maintained?

Dormant — no commits in 2+ years (last push 2021-12-30).

What license does y-websocket use?

The license is not specified in the explanation, so it is unknown what permissions are granted.

How hard is y-websocket to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is y-websocket for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.