13 ms·
Supabase – Realtime: Multiplayer Edition
- erulabs 4y agoCongrats to the Supabase team! Presence in general is a problem I'm tired of solving - so this will be a nice replacement for in-house solutions!
- mh- 4y agoIn case someone from Supabase sees this: there's something weird with the blog layout on iPhone. It goes really narrow. Main site renders fine.
- prox 4y agoAlso there is no page on what Supabase is, flicking through a few pages I still have no idea!
- samwillis 4y agoAt the top their homepage (which admittedly doesn’t have a link to it other than the logo): > Supabase is an open source Firebase alternative. Start your project with a Postgres Database, Authentication, instant APIs, Realtime subscriptions and Storage. https://supabase.com/ https://supabase.com/
- prox 4y agoAh gotcha, not really obvious.
- deleted 4y ago[deleted]
- samwillis 4y agoIt’s the embedded YouTube live video at the bottom of the post throwing the layout off.
- mildmustard 4y agoFixed :) thanks
- kiwicopple 4y agothanks - fix going out now
- danielvaughn 4y agoSo I'm just at the tail end of a project where I'm attempting to build a collaborative text editor, and it's been absolute hell. I figured it would be a tricky problem, but I had no idea how far down the rabbit hole goes. I kept thinking, gosh, there's gotta be a backend service that bakes this in, if there isn't it would be a great business opportunity. I almost want to scrap all of my code and move it to Supabase. Congrats to the team on this launch, very cool. edit: actually, after thinking it through, I'm not clear on what Supabase is calling multiplayer. Presence is one thing, but when I think multiplayer, I'm thinking conflict resolution. Is this an OT/CRDT implementation? Or is it just presence?
- samwillis 4y agoIt’s broadcast and presence they have released, both building blocks for multiplayer. It’s unfortunate that HN rules meant a mods changed the title to the blog posts title. I had gone with a slightly edited (for length) sentence from the second paragraph as I thought it was clearer: … general availability of Realtime's multiplayer features, Broadcast and Presence.
- upupandup 4y agohow does the pricing compare to liveblocks? was really offput by their pricing (charging $0.01 for every time a client connects)
- chasers 4y agoPricing is still tbd unfortunately. Currently every project gets these features with some limitations: - 25 concurrent channels - 25 channel joins per second - 200 concurrent connections - 100 broadcast messages per second avg over 60 seconds (not including db changes) (aka 6,000 per minute rolling) I think these are probably pretty close to where we'll land for free projects. They can be changed per project so if you (or anyone) needs a limit increased in the short term we can do that.
- stevenfabre 4y agoHi there, Im Steven, co-founder of Liveblocks. Thanks for your feedback on pricing. We try to have a fair pricing for everyone and for companies of all sizes. We’re working on a new pricing that will make this much more affordable, even free in most cases. Would love to get your feedback on that if you’re up for it? Thanks!
- samwillis 4y agoThis is really neat, I have been keeping an eye on Supabase, this (presence) is the feature that will finally push me to build a side project with it. I have one in mind. Anyone from Supabase here, do you have any plans to build in support for CRDT toolkits such as Yjs or AutoMerge for these features? It would make working with them so much easer if there was a plug and play backend. The one other thing I would love to see next from them is an offline sync product, so you could partially sync a users dataset to their device and save back any changes later (bonus points for then combing that with CRDTs). Maybe the WASM Postgres yesterday [0] could be a foundation for such a product. https://news.ycombinator.com/item?id=32498435 https://news.ycombinator.com/item?id=32498435
- Xeoncross 4y agoAgree, I would love to see CRDT (or related) multiplayer resolution as that's a big time sink for a lot of new collaboration product ideas around dashboards, documents, spreadsheets, online games, mindmaps, and flows (like figma).
- danielvaughn 4y agoYeah this actually confused me a bit - at first I thought "multiplayer" meant CRDT, but now I'm not sure. I got really excited there for a bit, lol.
- kiwicopple 4y ago> CRDT It's definitely something we'll support (we mention it briefly in the blog post). We'll extend this service so that it works well with WebRTC, and we have a few ideas for making it easy for development. > Maybe the WASM Postgres yesterday This was mind-blowing! Very cool what the crunchy team have done there. It would be awesome to replicate from a remote Postgres database to a "per-user" database to the browser. I think WASM support needs to improve before it can become generally useful for offline-sync, but the tech seems withing reach. We're working on various ideas for offline-sync, but the Realtime server will be central to whatever implementation we land on.
- samwillis 4y ago
- kiwicopple 4y agohey hn, supabase ceo here we're excited about this release - it adds a few neat features to our Realtime server[0]. For those who don't read the post (it's quite long), our Realtime server was initially built for subscribing to Postgres changes via websockets. We've added Broadcast functionality (for "ephemeral" messages that don't need to be persisted to Postgres) and Presence (similar to Broadcasts, but it retains an eventually-consistent state between users). We were planning a larger write-up with all the technical details but it became a bit long. Some highlights: - Realtime is built with Elixir an Phoenix[1] - We've moved to a single, global cluster - We're using `Phoenix.Tracker` to globally distribute the Erlang PIDs of all of our Postgres connections. This guarantees there is only a single connection to each database. - We've implemented a "leaky-bucket" rate-limiter using Erlang's `:counters` module[3] for "per tenant" rate-limiting. We'll move this to a global rate-limiter in the future - We're currently seeing ~2000 concurrent connected users - it will be interesting to see what this spikes up to now that this is on HN It's still in heavy development, and we'll make sure to detail all the choices we take as we continue solve problems. A few of the Realtime team will be here answer questions - @chasers, @wenbo, @abc3erl. [0] Realtime: https://github.com/supabase/realtime https://github.com/supabase/realtime [1] Phoenix Framework: https://www.phoenixframework.org/ https://www.phoenixframework.org/ [2] rate limiter: https://en.wikipedia.org/wiki/Leaky_bucket https://en.wikipedia.org/wiki/Leaky_bucket [3] :counters: https://www.erlang.org/doc/man/counters.html https://www.erlang.org/doc/man/counters.html
- guykdm 4y agoHey Kiwi, any chance of getting temporal.io style features for supabase edge functions? would love to have a one-stop-shop solution for all my real and not-real time needs.
- kiwicopple 4y ago(I'm assuming you want a queue/workflow engine) Temporal has done an incredible job of ensuring there will be no side-effects (even with external systems), so I doubt we'll be able to do something as extensive as they have. That said, we will probably build a simple Postgres queue/workflow engine (similar to pgboss[0]). It will live in the Postgres database (as an extension), but will be nicely integrated with Edge Functions. We haven't started this yet, so I don't have any timelines. [0] pgboss: https://github.com/timgit/pg-boss https://github.com/timgit/pg-boss
- fsiefken 4y agoI'm probably not the only one who thought this was about Supaplex https://supaplex.me/ https://supaplex.me/ - .a popular extended boulderdash clone - because of the term 'Multiplayer' before clicking the link. For those who didn't know, the dos game is now freeware and there is a reverse engineered open source multi-platform port. There is no multiplayer mod, yet.
- bebrws 4y ago
- tiborsaas 4y agoThe demo page is broken on mobile: https://imgur.com/a/BoLErlH https://imgur.com/a/BoLErlH Android 11 | Chrome 104
- wenbo 4y agoThanks, the demo isn't mobile responsive quite yet.
- jayd16 4y agoIs server authroity and broadcast permissions handled or left as a task for the user? Can channels be locked down to a list of users? Can users be kicked from a channel? Is message spam/flooding/DDOSing users in a channel protected? Quickly skimming the docs, I don't see any examples of this. Server authority and some of this security can be added app level but I think the message throttling needs to be built in if its going to support any kind of pvp/untrusted peer scenario. Anyone know the story there?
- wenbo 4y ago> Is server authroity and broadcast permissions handled or left as a task for the user? Can channels be locked down to a list of users? Broadcast permissions is currently not handled by the server and left to the developer to implement. We have discussed this internally and will prioritize Broadcast authorization accordingly because we've gotten feedback about this from a number of developers. > Can users be kicked from a channel? Not at the moment but again we've gotten feedback about this as well and will prioritize it. > Is message spam/flooding/DDOSing users in a channel protected? We have built rate limiting and other protections so bad actors don't affect the good in the cluster. A colleague of mine posted these limitations of Supabase Realtime to prevent abuse: https://news.ycombinator.com/item?id=32511586 https://news.ycombinator.com/item?id=32511586.
- tsycho 4y agoAre you planning to provide native iOS/Android APIs? Any ETA if yes?
- kiwicopple 4y agoYes, we are - but no ETA yet (sorry, we've been focused on the infrastructure). There are some community-developed libraries here: https://github.com/supabase-community https://github.com/supabase-community. We sponsor developers to maintain these - at some point we'll hire someone to work full-time on these (and we'll start with iOS/Android)
- nabakin 4y agomultiplayer.dev character limit is client-side fyi. Chat messages are encoded into HTML Entities so thankfully XSS doesn't seem possible
- wenbo 4y agoWen Bo from the Supabase Realtime team! Just want to confirm that we did put in place a client-side character limit.
- nomel 4y agoIn safari, with the multiplayer.dev demo, my own chat bubble is terribly unsmooth, when I move my mouse. It almost looks like it's getting a local and, slightly delayed, remote position update, and they're fighting. Screen recording, with latency around 90: https://imgur.com/a/5FU3paR https://imgur.com/a/5FU3paR
- tlarkworthy 4y agoWhat happens over an unreliable network connection such as mobile?
- wenbo 4y agoWen Bo from the Supabase Realtime team here! Client will seek to continuously reconnect to the WebSocket when there's a connection issue and server must receive at least one heartbeat in a 60 second window; otherwise it will clean up the WebSocket connection. We built Supabase Realtime on top of Phoenix Channel, and along with our clients, handles unreliable network connections gracefully, including on mobile.
- tlarkworthy 4y agoSo you will lose messages. "Phoenix uses an at-most-once strategy when sending messages to clients. If the client is offline and misses the message, Phoenix won't resend it. Phoenix doesn't persist messages on the server. If the server restarts, unsent messages will be gone. If our application needs stronger guarantees around message delivery, we'll need to write that code ourselves. Common approaches involve persisting messages on the server and having clients request missing messages. For an example, see Chris McCord's Phoenix training: client code and server code." https://hexdocs.pm/phoenix/channels.html https://hexdocs.pm/phoenix/channels.html It will be impossible to build a reliable mobile experience on top of such shaky foundations.
- wenbo 4y ago> So you will lose messages. This is true but you can store your messages inside your database and on reconnect you can fetch the messages you missed.
- tlarkworthy 4y agoyou need a queue to do that properly, do your users have to manage that queue?
- didip 4y agoIt seems like Elixir is the language of choice for building a large scale real time solution, then?
- sidcool 4y agoOne author of the post has title of engineering while the other has title of engineers. Typo?
- kiwicopple 4y agothanks - fixed: https://github.com/supabase/supabase/pull/8492 https://github.com/supabase/supabase/pull/8492
- krzyk 4y agoWhat is supabase? The page doesn't have description that is easily accessible from mobile. All I know is that it has a real time server and multiplayer. Sounds like a game.
- kiwicopple 4y agoFrom our homepage: > Supabase is an open source Firebase alternative. Start your project with a Postgres Database, Authentication, instant APIs, Realtime subscriptions and Storage. Our docs give details about the architecture for each project: https://supabase.com/docs/architecture https://supabase.com/docs/architecture
- squeaky-clean 4y agoFYI multiplayer.dev breaks the browser back button. At least on mobile safari. Is that a glitch in that demo specifically? Or is it a supabase realtime glitch?
- kiwicopple 4y agoI imagine it's a glitch caused by the way the demo "redirects" a user to a room. Probably you hit back and then get redirected again. Sorry about that - it's not intentional. I'll let the team know.
- wenbo 4y agoWen Bo from the Realtime team here! That back button glitch is specific to the demo. We had to do a few redirects based on Presence sync and load balancing each room. I'm sure there's a better way of doing it and will seek to improve it when I update it. Sorry about that!
- squeaky-clean 4y agoNo worries, figured I'd mention it. Those redirect flows are really tricky.
- mmastrac 4y agoWhat's the difference between Supabase open-source and the paid versions? Is that just around hosting? EDIT: Googling around yields a somewhat hostile discussion from last year: https://news.ycombinator.com/item?id=26637360 https://news.ycombinator.com/item?id=26637360 ... but it looks like you _can_ self-host? https://supabase.com/docs/guides/hosting/docker https://supabase.com/docs/guides/hosting/docker
- kiwicopple 4y agoYes, you can self host and everything is open source (including the Dashboard[0]). Everything is either MIT, Apache2, or PostgreSQL licensed. > difference between Supabase open-source and the paid versions On the paid version we handle some of additional database management (like daily backups, PITR, etc). These are technically available for self-hosting too, because the database is just a Postgres database, but I point it out here because it's not something you'll get "out of the box" from the Docker setup. Our philosophy with open source is "offer everything" and then charge for usage. There aren't any features completely gated. Our Enterprise plan just adds additional SLAs and support packages for our cloud platform. In addition to the self-hosting docs you've linked, in our GitHub you can find the Docker files[0] and some community-developed self-hosting strategies [2] [0]https://supabase.com/blog/supabase-studio https://supabase.com/blog/supabase-studio [1] docker: https://github.com/supabase/supabase/tree/master/docker https://github.com/supabase/supabase/tree/master/docker [2] community: https://github.com/supabase-community/#self-hosting https://github.com/supabase-community/#self-hosting
- rosmax_1337 4y agoThis is intresting. I've been thinking about using the web for more multiplayer games for a while, and a tool like this is more or less exactly what I'm looking for. Noone wants to make netcode. (Comment also acts as a bookmark) :)
- wiradikusuma 4y agoWhy would I use Supabase instead of Firebase since the latter is more mature and has richer ecosystem? [v] Can host myself [v] Can access from China (since Firebase is blocked) [v] ...anything else? (Btw they should put this in FAQ or something)
- burggraf 4y agoSupabase developer here. Coming from Firebase myself, the biggest driver for me can be summed up with: relational data. PostgreSQL rocks.
- jitl 4y agoPostgres is more mature than Firebase
- digianarchist 4y agoFirebase doesn't even have good search support and it's a Google product...
- gitgud 4y agoThat has always annoyed me, the one thing that isn't integrated into Firebase...
- wenbo 4y agoWen Bo from the Supabase Realtime here! Also, every single person on the Supabase team actively does support so if you would like world class support than look no further!
- cpursley 4y agoIt sounds like Supabase is pulling out the WAL listening bits into its own library? https://supabase.com/blog/supabase-realtime-multiplayer-general-availability#extensions https://supabase.com/blog/supabase-realtime-multiplayer-gene... If so, y'all might want to look into: https://github.com/elixir-ecto/postgrex/blob/master/lib/postgrex/replication_connection.ex https://github.com/elixir-ecto/postgrex/blob/master/lib/post...
- kiwicopple 4y agoThe database listener in this version of Realtime uses Postgrex - it's great
- cpursley 4y agoSuper! Y'all are doing amazing things. Where can I see that in the code? Or is not quite out yet?
- wenbo 4y agoWe started developing Realtime: Multiplayer version many months ago in a private repo just to experiment with Phoenix's Broadcast and Presence and over time we just added to it. We plan to move all the code over to https://github.com/supabase/realtime https://github.com/supabase/realtime in the next couple of weeks and you'll be able to see the code in its entirety.
- wenbo 4y agoWen Bo from the Supabase Realtime team here! We actually use https://github.com/supabase/walrus https://github.com/supabase/walrus to get the database changes and we're planning on moving to a Rust worker (https://github.com/supabase/walrus/tree/worker/worker https://github.com/supabase/walrus/tree/worker/worker) for better performance especially in the RLS-enabled use case. I promised José that I would check out Postgrex.ReplicationConnection and we might add it in to our Supabase Realtime some time in the future.
- majestic5762 4y agoI've been watching Supabase for a long time and wanted to try it out. I had the chance to use it in a couple of projects that I started, but I feared it will cause me problems down the road, and eventually I decided to build the backend services myself. I'm comfortable with NestJS which is not supported in Deno, and I felt that my productivity would've been harmed if I picked up Supabase. But definitely I have to build up confidence by starting a personal project. Is there anyone who uses Supabase in production? Do you have any feedback?
- abcdjdjd 4y agoI don't get the advantage of using supabase or things like it. It feels like you are basically relying on a third party to do the work for you and you are paying them to do it. Doesn't seem portable at all. If you make your own code, you can move it wherever you want in whatever system you want. It seems like if you use this product, it will get you stuck in that environment and if you need to upgrade, then you are going to have to do the work later on anyways. What exactly is so great about this product? I'm not saying its bad, I'm just not fully understanding the advantages of using it? Why would someone want to use this over something like a framework for the backend (that is free) and a database they want and then host it wherever they want? I don't really get why someone who knows how to code would want to pay extra money to build a backend.
- nl 4y ago> It feels like you are basically relying on a third party to do the work for you and you are paying them to do it. Yes, which is great sometimes. > I don't really get why someone who knows how to code would want to pay extra money to build a backend. Because reinventing the wheel isn't the best use of time. It's more fun to work on interesting problems than yet another backend, again. > Doesn't seem portable at all. If you make your own code, you can move it wherever you want in whatever system you want You realize it is all open source and can be self-hosted, right?
- jononomo 4y agoYou're going to have to pay to host your Rails/Django/Whatever app anyway, and you're also going to have to pay for a hosted Postgres solution, so why not just get them both in one deal and then also dispense with the need for a bunch of Rails code thanks to the auth and REST api that is built in to Supabase.
- moralestapia 4y agoGreat day for the backend :D Cool announcements for Pinecone, PlanetScale and Supabase.
- gavi 4y agoI built backend for my typing app using supabase with row level security(RLS) and OAuth providers to track. https://typingkit.com https://typingkit.com Supabase + SvelteKit + Cloudflare
- berjin 4y agoI have a multiplayer web game also on SvelteKit but I created my own little sockets server with Go and Redis streams running on a tiny k8s cluster. I'm curious how much traffic you're getting and how much it costs to run it. https://redactle-unlimited.com https://redactle-unlimited.com
- shermablanca 4y agoKudos on this! It's really nicely done and works well.
- alberth 4y agoAm I wrong in understanding that some of these capabilities sounds similar to what mnesia offers? https://www.erlang.org/doc/man/mnesia.html https://www.erlang.org/doc/man/mnesia.html
- kabes 4y agoNot directly related to the realtime server. But anybody that tried both Supabase and Hasura and can give their thoughts on how they compare?
- barryhennessy 4y agoCongrats on the launch and hitting HN's front page. Do you mind if I ask how your example site (multiplayer.dev) scaled? I'm super curious about realtime multiplayer solutions (and I don't think I'm alone). But I find a great lack of info on what running this kind of app would cost. I come from the old-school hold-no-state, request->response->gtfo mentality, and I always have the _feeling_ that it'd be expensive to scale. Not just holding the websocket open, but how much effort do you expend parsing the WAL? How chatty is that kind of persistence mechanism? What other 'gotchas' are there etc. I'd love nothing more than to dispel that vague feeling with data. I know it wouldn't come close to a full performance analysis, but throwing a few datapoints on a chart would help get a ballpark idea and tune my hype->action conversion. I could nail down a pile of questions, but I'm sure you know better than I how to measure your own systems. But roughly I'm wondering: - how many users did you have? - how much traffic did you get? - how much would/did it cost to host on supabase? - how much resources did the database/realtime components consume? Congrats again on the launch and have a nice weekend.