mastodon.ie is one of the many independent Mastodon servers you can use to participate in the fediverse.
Irish Mastodon - run from Ireland, we welcome all who respect the community rules and members.

Administered by:

Server stats:

1.6K
active users

#websockets

0 posts0 participants0 posts today

For people with large WebSocket workloads using the ingress-nginx controller.

I recently hit this issue:

github.com/kubernetes/ingress-

This drops all current WebSocket connections when ever the controller reloads the config. This can be triggered by adding/removing a new Ingress object (which this project does regularly due to customer load).

We ended up moving the WebSocket ingress to a separate LoadBalancer/Ingress class.

Continued thread

…And there are more interesting tid-bits in there too:

• See how I’m pushing Kitten’s Streaming HTML to its logical conclusion and streaming JavaScript from the server to the client to keep all logic on the server while implementing a client-side feature (copy to clipboard): codeberg.org/small-web/look-ov

• Following on from that, note how the Toast component that’s triggered when something is copied looks (under the hood, Streaming HTML is htmx + WebSockets + some Kitten-specific magic and glues it all together and adds syntactic sugar): codeberg.org/small-web/look-ov

• Finally, check out how layout components and slots work: codeberg.org/small-web/look-ov

I think that’s all the intersting stuff I can spot at the moment.

Have fun!

:kitten:💕

codeberg.orgMaking sure you're not a bot!

Today I learned…

1. there's a card game where you complete a task from Unix pipe commands: punkx.org/unix-pipe-game/ (via mamot.fr/@bearstech/1142758430)
2. there's a JavaScript x86 machine emulator so you can play that game without needing a real computer around: bellard.org/jslinux/tech.html
3. that JS VM gets network connectivity because someone decided to make a websocket-based VPN that passes Ethernet frames: benjamincburns.com/2013/11/10/

punkx.orgThe UNIX Pipe Card Game

New Kitten update

kitten.small-web.org

• Added `remove()` method to kitten.Component class. Use this when working with live pages and components and you want to remove a component from the page (or its parent). It will handle removing event listeners for you so you don’t end up with any memory leaks.

• Improved `update()` method so it similarly removes listeners on child components before updating the component itself in case you have class-based child components that will be reinstantiated on render.

• Updated the `send()` methods on `page.everyone` and `page.everyoneElse` so you can pass a swap target to insert the element being streamed to the page before, after, asFirstChildOf, or asLastChildOf another. (This was already there for the page.send() but now the two broadcast objects have the same consistent interface.

The @small-web/kitten npm package (Kitten’s types package) has also been updated to version 5.1.0 to reflect the latest changes.

(Remember that the new class and event-based page and component model is still experimental and largely undocumented and fully backwards compatible with the classic functional way of authoring your page routes and components.)

Enjoy!

:kitten:💕

A quick demonstration of using the State: Overview page in Kitten’s¹ settings while developing to keep an eye on your event and event listener counts to avoid memory leaks.

Notice how the events and listeners counts change as I navigate between the People and Settings pages in my Place² node and that they are consistent. If they were rising as I navigated back and forth I’d know I had a memory leak somewhere.

If you use Kitten’s built-in features (e.g., the `addEventHandler()` method on your `kitten.Component` subclasses, Kitten will handle adding and removing listeners for you automatically during your component’s lifecycle. You can also do so manually in your component’s automatically-called `onConnect()` and `onDisconnect()` event handlers.

This view is useful during development to ensure you don’t have any memory leaks as pages are loaded and unloaded.

vimeo.com/1050714714

¹ kitten.small-web.org
² Place is in early development at the moment (codeberg.org/place/app)

From the @DSLC :rstats:​chives:

:rstats: "Web APIs with R: Find APIs & Communicate with other types of APIs" youtu.be/hDfrbKOMuyU #API #APIs #RStats #graphql #websockets #gRPC

:rstats: "Bayes Rules! MCMC under the Hood" youtu.be/CCpL8IpUTEE #RStats

:rstats: "Probabilty for Data Science: Discrete Random Variables Exercises" youtu.be/xHclZpPPLwA #RStats

Visit dslc.video for hours of new #DataScience videos every week!

Pretty soon, you’re going to be able to view your live pages and the events on them in real time while developing Kitten apps.

The improved component model with support for class-based routes (and a server-side component hiearchy that lets you build well-encapsulated components and pages and work in an event-driven way) is coming along nicely and I’m back to writing Place¹ using it.

(In the GIF, you’re looking at Place’s profile settings page. Not shown here but those profile changes reflect in realtime on all open pages. The highlighted piece of code is what streams the event details to the browser.)

¹ codeberg.org/place/app

Feeling more like myself today after getting my ass kicked by this bug for the past few weeks and I’m finally making progress on improving Kitten’s¹ component model.

Soon, you’ll be able to implement page event handlers in an even simpler way than before. Is your connected DOM element named `pixel`? Then export an event handler called `onPixel()` on your page route and it’ll get called when that element triggers its event.

And there’s so much more coming, including a class-based page and component model with DOM-style event bubbling on the server. This should really let you make the most of the Streaming HTML² workflow in Kitten by writing event-driven GUI-like code but for a web app without really caring about the client/server separation.

Need to update the examples, test, test, test, and update docs but this had me stumped for a while now with several false starts and I feel this implementation might just be it 🤞

:kitten: 💕

¹ kitten.small-web.org
² kitten.small-web.org/tutorials

Just added a code breakdown for the Draw Together¹ Kitten² app to my blog post with the tutorial video:

ar.al/2024/03/26/draw-together

Draw Together, in ~50 lines of code, is a real-time collaborative drawing tool on a 20×20 pixel grid where people can click to toggle the colour of each pixel.

(The full source and explanations fit the four screenshots on this post.)

¹ draw-together.small-web.org
² kitten.small-web.org