Menu

Building a share-a-link code editor with Socket.IO, and the shortcut I took on sync
📰

Building a share-a-link code editor with Socket.IO, and the shortcut I took on sync

DEV Community: node·Logappradeep·about 17 hours ago
#cJOqIxBJ
#devtonodejs#devto#dev#code#room
Long article (805 words) — no AI summary yet.
Reading 0:00
15s threshold

Sometimes you just need to look at the same code with someone: a quick pairing session, an interview question, a snippet a colleague can't get working. Screen sharing is laggy and nobody else can type. Full collaborative IDEs are heavy for a five-minute job.

So I built Code Share , a share-a-link code editor, as part of ToolkitHub. This post is about the architecture, including the shortcuts I took on purpose and where they stop working.

Rooms are just URLs

There is no sign-up. Opening https://code.toolkithub.in/anything puts you in a room called anything ; opening the bare domain generates a random room ID and pushes it into the address bar. Sharing the room means sharing the URL. You pick a display name, and everyone in the room sees each other's presence and cursors.

The sync model: whole document, last write wins

The editor is Ace in React, connected to a Node server over Socket.IO. When you type, the client sends the full document:

// server socket .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.