News for hackers. Stuff that matters.
Re:Show HN: DriftDB is an open source WebSocket backend for ... by rlt on Friday February 03, 2023 @07:46AM (#34640352)
Neat.

> DriftDB is a real-time data backend that runs on the edge

What does it mean for these backends to be “on the edge”? Do geographically disperse clients connect to different backends? If so are messages synchronized between them? If so what’s the point of them being on the edge?

Re:Show HN: DriftDB is an open source WebSocket backend for ... by paulgb on Friday February 03, 2023 @07:53AM (#34640413)
By “on the edge”, I mean that if you’re in London and I’m in Amsterdam, and we want to exchange messages, the messages shouldn’t have to do a round-trip through Virginia, they should go through a server closer to both of us. (Of course, if I’m in SF and you’re in London, this is less of a win.)

The way it works in DriftDB is that everything is siloed into “rooms”, which are effectively broadcast channels. The room is started based on the geography of the person who first joins it (Cloudflare handles this part).

Re:Show HN: DriftDB is an open source WebSocket backend for ... by rlt on Friday February 03, 2023 @07:57AM (#34640452)
> The room is started based on the geography of the person who first joins it

Cool, makes a lot of sense because people using a given “room” are often likely to be geographically collocated.

Re:Show HN: DriftDB is an open source WebSocket backend for ... by paulgb on Friday February 03, 2023 @08:10AM (#34640563)
Exactly!
Re:Show HN: DriftDB is an open source WebSocket backend for ... by trollitarantula on Friday February 03, 2023 @09:31AM (#34641440)
Nice! Would love to see Cloudflare deployment guide. Cloudflare isn't mentioned in the docs.
Re:Show HN: DriftDB is an open source WebSocket backend for ... by paulgb on Friday February 03, 2023 @09:36AM (#34641496)
Ah, you’re right, I haven’t written that up yet. The tl;dr is something like:

    cd driftdb-worker
    npm i
    npm run deploy
You’ll need to sign in to wrangler if you haven’t already, and will need to have rustc/cargo available (wrangler will install some things and build it into a WebAssembly module).
Re:Show HN: DriftDB is an open source WebSocket backend for ... by SpaghettiX on Friday February 03, 2023 @07:07PM (#34649677)
A bit more detail since I've used Cloudflare Durable objects:

DriftDB's cloudflare implementation uses durable objects, so you need a "workers paid subscription: https://developers.cloudflare.com/workers/runtime-apis/durab.... It's $5/month.

Side note: the durable object API is quite verbose, so it's nice to see something building on-top-of/encapsulate that. I wonder if this would compete with Cloudflare's pub/sub product though. I wonder how Cloudflare will handle situations like this. They don't look so good today after taking down a customer: https://news.ycombinator.com/item?id=34639212

Re:Show HN: DriftDB is an open source WebSocket backend for ... by kentonv on Friday February 03, 2023 @09:04PM (#34650607)
Durable Objects is a low-level primitive which you can certainly build all sorts of distributed systems on -- including ones that compete with our own products. In fact, those products of ours are often themselves built on Durable Objects!

Personally, I would be absolutely thrilled to see people building their own custom versions of these products directly on DO, and I think the rest of the team would agree. Our goal is to productize our physical network (machines in hundreds of locations worldwide). We build high-level products to make it easier for people to use us, but if you want to build your own versions of those products based on our lower-level primitives, that's great!

(I'm the lead engineer on Workers.)

(I don't know the story with that other customer from earlier today, so cannot comment there, sorry.)

Re:Show HN: DriftDB is an open source WebSocket backend for ... by HighlandSpring on Friday February 03, 2023 @01:23PM (#34645549)
Oh, cool! So kinda like IRC?
Re:Show HN: DriftDB is an open source WebSocket backend for ... by paulgb on Friday February 03, 2023 @01:27PM (#34645635)
Yes, the concept of rooms is analogous to rooms in a chat service. One difference from IRC as a protocol (besides being over websocket) is that each connection corresponds to exactly one room (since different rooms may be on different servers.)
Re:Show HN: DriftDB is an open source WebSocket backend for ... by fernandopj on Friday February 03, 2023 @07:53AM (#34640405)
OP must have meant it runs on Cloudflare Edge.
Re:Show HN: DriftDB is an open source WebSocket backend for ... by scaredginger on Friday February 03, 2023 @07:56AM (#34640435)
Please explain your reasoning here
Re:Show HN: DriftDB is an open source WebSocket backend for ... by paulgb on Friday February 03, 2023 @08:14AM (#34640601)
That’s essentially what I meant. The core database is separate from the Cloudflare parts, so it could in theory run on other edges (I want to get it running on fly.io!), but for now “the edge” can be read as “Cloudflare Workers”.