<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>DataDreamsDragons</title>
        <link>https://paragraph.com/@datadreamsdragons</link>
        <description>undefined</description>
        <lastBuildDate>Thu, 13 Aug 2026 04:43:06 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <copyright>All rights reserved</copyright>
        <item>
            <title><![CDATA[My Experiments with Showcast]]></title>
            <link>https://paragraph.com/@datadreamsdragons/my-experiments-with-showcast</link>
            <guid>WunhcNpmX0FoQ8FXSuvO</guid>
            <pubDate>Thu, 16 May 2024 20:19:15 GMT</pubDate>
            <description><![CDATA[My Experiments with Showcast - A Thread - Part I:In a galaxy, far, far away, there was an idea. By @saxenasaheb. It started as a fun exercise of conn...]]></description>
            <content:encoded><![CDATA[<p></p><p><strong>My Experiments with Showcast - A Thread - Part I:</strong></p><p>In a galaxy, far, far away, there was an idea. By @saxenasaheb. It started as a fun exercise of connecting frens with FC accounts randomly on a video call (ala Omegle).</p><p>Assessed the requirements, went through a couple of github repos around randomised calling. Easy, peasy.</p><p>Infra to setup video calling - Check<br>Farcaster based Auth - Check<br>People eager for it - Check</p><p>This started way back in February.&nbsp;I quickly cobbled together a prototype using Huddle’s Video calling sdk. The Farcaster auth kit helped set up the auth pathway.</p><p>So far, so gooood! Flying out of the blocks. An ugly but working prototype when connecting 2-3 people. WGMI!</p><p>But then, it is a dev’s life. Our happiness makes the universe conspire to take it away from us!</p><p>Challenge 1: Make Huddle Auth work with Farcaster Auth (custom credential provider built over SIWE)</p><p>Mistake: I thought I need to make them work together. Looked into custom JWT (fetching &amp; wrapping Huddle room token into another token which would also serve as the auth for Showcase app on top of FC auth). Way too complicated an approach.&nbsp;</p><p>Got deeper and deeper into auth &amp; JWT mechanisms, loved the learning aspect of it and forgot the original purpose.&nbsp;</p><p>(And THAT is why we devs need great product managers! And a problem that I am consciously working on!). I spent about a week down this rabbit hole. Went nowhere but learnt a ton of stuff.</p><p>Meanwhile, #wenshowcast grumblings were just starting to appear.</p><p>Correction: Separated out both the auth mechanisms.&nbsp;</p><p>Showcast would work on and accept FC Auth and the session generated would serve as the basis for all interactions within the app. Huddle API &amp; room token auth would work as another layer nested inside and only for interactions with the video room.</p><p>So obvious in hindsight!</p><p>Challenge 2: Randomisation in room allocation</p><p>The core question was: "How do you allocate a room at random to a user signing in?”</p><p>Mistake: Convoluting a logic based on a custom random allocation logic by storing the room states in my own DB while also trying to use the Host-Peer joining &amp; participants mechanisms provided by Huddle API simultaneously</p><p>Overengineering dev brain at work again!</p><p>Correction: Isolated all Huddle interactions. Forced myself to ignore their data apis aournd details of a room and number of participants in them. Setup own DB with rooms table having three main columns: huddleRoom | hostJoined (bool) | peerJoined (bool)</p><p>The two columns could also have been setup as roomStatus as available and occupied. I could visualise the binary flags in terms of the four combinations better (TT, TF, FF, FT) (T and F being True and False). Since, I would treat both users equivalently, TF and FT states were equivalent.&nbsp;</p><p>So, this was the basic outline for the algorithm:</p><p>Whenever a user signed in, the app would look up in the DB and find if the rooms with state as TF&nbsp; (available with one user sitting).</p><p>If yes, pick a random room from this list and send the user to that room and mark the room as TT.<br>If no, it would look for rooms with state as FF (vacant). Pick a random room &amp; send the user there and mark it as TF.<br>If no again (no vacant rooms), create a new room and send the user there.</p><p>The reverse process would happen when you left a room - TT =&gt; TF | TF =&gt; FF</p><p>This was all happening just after the user had signed in. Logic was sound and testing with a few users, things seemed to be working.&nbsp;</p><p>There were CSS issues around matching it with the design and responsiveness. But I had folks helping me (thanks to 0xbhaisahab and Idrees)</p><p>I knew it was slow! But, confirmation bias led me to believe it was decent enough to launch.</p><p>Dev nirvana achieved. This was sometime in March. We had launched a website and domain. But that was the extent of it.</p><p>Also identified another problem which I will discuss below. Was hoping though it would not be an issue till we had achieved a decent number of users.</p><p>Can you guess what that was?</p><p>A few other projects came along and gradually I lost interest in taking this forward.</p><p>The murmurs of #wenshowcast would occasionally appear in the Telegram channels, often led by Saxenasaheb but was too occupied with other stuff. And so, April went by.&nbsp;</p><p>Everything - live but dormant with a few css niggles.</p><p>In my mind, I was “over it” so to say. I buried it in the graveyard of dormant products and paid my respectful obituary with my final commit message.&nbsp;</p><p>"I thank thee for the learnings. Thy watch is now over. Rest in peace till forked”</p><p>And, git push!</p><p>And then, FBI Fellowship happens.&nbsp;</p><p>Saxenasaheb calls me up, asks me to launch Showcast at the Fellowship and leads a revolution of #wenshowcast everywhere.</p><p>And just like that, Showcast was undead!</p><p>Fixed the css issues &amp; a couple of days back, pushed the final code into production (followed by premature celebrations).&nbsp;</p><p>It built successfully on Vercel. Did a very soft test with 4 people. It worked as expected - joined the room at random, left it to be reassigned another random room and so on.&nbsp;</p><p>I thought it was ready for launch (again). Then worked on the other project @basedbuilders for the rest of the day. Oh, how happy I was!</p><p>Challenge 3:&nbsp; Race conditions strike back! Now that’s what I am talking about!</p><p>Mistake: Yesterday, we went for a soft launch with 8-10 people at the fellowship and all hell broke loose.</p><p>Slow internet + 5-10 second latency in joining and leaving rooms + similar latency in updating the database flags for available rooms’ state = recipe for disaster.&nbsp;</p><p>People were being assigned the same rooms before it could get updated in the DB and be removed from the pool of available rooms.</p><p>I had never seen a live demo of race conditions working to perfection in your life.</p><p>It was hilarious and tragic at the same time.</p><p></p><p><strong>My Experiments with Showcast - A Thread -  Part II:</strong></p><p>Before I get into the ongoing effort to ship Showcast,&nbsp; a massive massive thank you to @proxystudio.eth for motivating me to do this &amp; share this story with everyone!</p><p>Correction: So where were we! Yeah! Race conditions!</p><p>Once everything broke, was forced to go back and review everything.<br>I knew deep in my heart that it was a case of race conditions but still wanted to be sure before moving ahead with revamping the whole thing.</p><p>Kudos to @vrajdesai from Huddle for sitting together on such a short notice and reviewing the code and algorithm.</p><p>He came to the same conclusion - race conditions due to latency.</p><p>No way out. Have to revamp. Dev shortcut path cut short!&nbsp;</p><p>We came up with two potential solutions.</p><p>Solution 1: A transaction at DB level which could lock the DB for each user, run the randomisation algo, allocate the room &amp; update the room state (TT, TF) - an implicit sequential processing for each user.</p><p>Pros: Resolves it at the source</p><p>Cons: Required SQL may be too convoluted for maintaining it</p><p>Solution 2: A queue (Kafka) -&nbsp;</p><p>User signs in &amp; their id gets added to a queue.</p><p>A consumer receives the user id &amp; picks a room.</p><p>A new table to maintain (userId | allocatedRoomId) was added.</p><p>Meanwhile, the user waits in a lobby &amp; keeps polling to find out the roomId assigned to them.</p><p>Sounds simple, doesn’t it?</p>]]></content:encoded>
            <author>datadreamsdragons@newsletter.paragraph.com (DataDreamsDragons)</author>
            <category>buildingirl</category>
            <category>buildinpublic</category>
        </item>
    </channel>
</rss>