About that enhanced WebSocket support in the next curl release, e.g. next Wednesday:
#curl #websocket
About that enhanced WebSocket support in the next curl release, e.g. next Wednesday:
#curl #websocket
yesterday at #DevConf_CZ I talked about browser automation with #webdriverbidi . You can do cross-browser remote control or website/Web app testing with nothing more than a #websocket client, such as websocat or python-aiohttp or anything else. This shows the history and working your way up from interactive direct protocol in websocat over shell script to a comfy #python library. Everything is in this repo:
If you are an #IoT #developer and need to combine several #protocol #bindings for an #IoT system, the acmeCSE provides a great environment for learning and experimentation https://acmecse.net/home/Supported/ #CoAP #http #MQTT #WebSocket
New Kitten release
• New: Lovely new icons¹ and new callouts in Kitten Settings²
• New: Markdown now supports attributes and bracketed spans³
• New: client-side `kitten` global with `trigger` function for triggering events on the server from the client. (Useful when streaming client-side JavaScript when using Kitten’s Streaming HTML⁴ workflow. e.g., when you have to use a client-only web API like the Clipboard API but you want to keep all your logic on your server-side page.⁵)
• Fixed: The bound render function returned by `KittenComponent` class’s `component` getter now correctly awaits asynchronous templates. (In Kitten, you don’t have to care whether your templates contain promises. Kitten handles all that for you.)
Enjoy!
¹ https://kitten.small-web.org/reference/#icons
² https://mastodon.ar.al/@aral/114381983893061099
³ https://kitten.small-web.org/reference/#markdown-support (also see https://mastodon.ar.al/@aral/114381462302862256)
⁴ https://kitten.small-web.org/tutorials/streaming-html/
⁵ e.g., See how I use this to implement a copy to clipboard button in the database page of Kitten’s Settings: https://codeberg.org/kitten/app/src/branch/main/web/%F0%9F%90%B1/settings%F0%9F%94%92/db/index.page.js#L33 Of course, you don’t have to use this and you can just write client-side JavaScript or use the built-in Alpine.js integration. e.g., how I do it on the (older) settings/identity page: https://codeberg.org/kitten/app/src/branch/main/web/%F0%9F%90%B1/settings%F0%9F%94%92/identity/index.page.js#L7
If you are a #developer and need to combine several #protocol #bindings for an #IoT system, the ACME-CSE provides a great environment for learning and experimentation https://acmecse.net/home/Supported/ #CoAP #http #MQTT #WebSocket
New Kitten Release
• Automatic message routing: if the element that triggers an event on the client does not have a `name` attribute, Kitten now falls back to using its `id` instead to route the event to the correct server-side event handler on your live Kitten pages.
If neither attribute exists, Kitten will fail to route the message but no longer crash as it was due to a regression introduced when I implemented support for colons in element names.¹
For more details on Kitten’s live pages and automatic message routing, please see the Streaming HTML tutorial:
https://kitten.small-web.org/tutorials/streaming-html/
Enjoy!
¹ A colon in an element name is ignored for message routing purposes, letting you, for example, give unique names to <details> elements, allowing more than one to be open at a time, while having their events be handled by the same handler.
New Kitten release
• Fixes issue with routes where dynamic routes with file names that had more than two extensions were not recognised as the correct type of route. e.g., A route called index.xml.get.js would previously have been treated as a static route instead of a dynamic GET route.
For more details, see the Valid File Types section of the Kitten reference¹ and the Dynamic Pages tutorial².
Enjoy!
¹ https://kitten.small-web.org/reference/#valid-file-types
² https://kitten.small-web.org/tutorials/dynamic-pages/
New Kitten release
• You can now use key paths in the names of your client-side live components and these will automatically be transformed into object hierarchies on the server for you.¹
• Self heals zombie live pages (see Streaming HTML workflow²) if they return to life due to client-side browser cache.³
• Removes htmx⁴ headers from `data` property into separate `header` property in Kitten Page events and the data your Kitten Page message handlers receive.
• Automatically passes references to the live page object (if any) and the request and response objects to the layout templates of Markdown pages⁵ (so you can, for example, check if `request.session.authenticated`⁶ is true from the your layout template and customise the layout accordingly).
Enjoy!
¹ e.g., See https://codeberg.org/small-tech/site/src/branch/kitten/admin%F0%9F%94%92/news/index_%5Boptional-postId%5D.page.js#L356 (markup) and https://codeberg.org/small-tech/site/src/branch/kitten/admin%F0%9F%94%92/news/index_%5Boptional-postId%5D.page.js#L173 (handler) and https://codeberg.org/small-tech/site/src/branch/kitten/app_modules/database/database.js#L95 (model class method).
² See Streaming HTML tutorial: https://kitten.small-web.org/tutorials/streaming-html/ (There’s actually more to it now but I haven’t had a chance to document the new class-based and event-driven live page workflow yet. It’s experimental but working very well for me so far so I will do so shortly.)
³ When a person leaves a live/connected page (a page connected to its default web socket), we clean up and remove that live page from memory. However, browsers being what they are, cache the page on the client. If a person uses the back/forward buttons to return to the page, the browser will serve the cached source from memory, which has the old page ID, for the page that no longer exists in Kitten’s memory. So now we have a problem. The only way to recover from this is to tell the page to reload itself. So we accept the WebSocket connection, send a command to the page for it to reload itself, and then close the socket. That makes the stale page self heal by replacing itself with a fresh one. Yay, go us!
⁴ HTMX: https://htmx.org
⁵ Kitten Markdown pages reference: https://kitten.small-web.org/reference/#markdown-pages-page-md-files
⁶ See Session tutorial: https://kitten.small-web.org/tutorials/sessions/
May I just say so myself that I‘m loving playing with Kitten¹ to build Domain² (shown below) and Place³.
¹ https://kitten.small-web.org
² https://codeberg.org/domain/app
³ https://codeberg.org/place/app
New Kitten¹ update
Experimental:
• Adds `data` property to Kitten components
• Adds swap target to `page.send` so you can have an element added before, after, as first child of, or as last child of another (this is syntactic sugar over htmx and works around some of the complexities with out-of-band swaps in htmx, especially when streaming table rows to tables).
Also, check out the latest live page and page events state view in Kitten’s Settings (every Kitten app has this settings view).
So last night, while recording the preview of Kitten’s¹ improved component model², I made a silly mistake (copying raw HTML into a JavaScript function instead of wrapping it in a kitten.html`` tagged template, easy to do when you’re refactoring to pull out components from pages).
Then, once I figured out what I’d done, I made another one by forgetting to return the value from the function (easy to do when you’re used to using one-line closures as render functions).
I would have caught both of those so much faster if Kitten had helpful error messages for those two pitfalls. And guess what, this morning, it does :)
Attached are screenshot showing the before and after error messages.
Enjoy!
¹ https://kitten.small-web.org
² Scroll up the thread to watch the video.
Little preview video: Kitten’s improved component model
• Class-based page routes and components
• Object-oriented
• Event-based
• Seamless hypermedia-driven WebSocket-based event mapping and interface updates (Streaming HTML)
• A light server-side live component hierarchy with event bubbling
• Almost as if you’re building a desktop or mobile app instead of a web app…
… another authoring simplification made possible because on the Small Web – which is a peer-to-peer web – you build a web app/site as a tool for one person (the owner of the site/app) instead of as a tool for you to farm millions of people.
… still experimental ;)
Learn more about Kitten:
If you like what you see and want us to keep existing, we could definitely use your support:
https://small-tech.org/fund-us/
@lumen Hey, thanks so much :)
The main two apps that will initially be using it are Place (https://codeberg.org/place/app) and Domain (https://codeberg.org/domain/app) — both under heavy development at the moment.
There are some mini apps I made that you can play, each with their own tutorial.
• Draw Together (https://draw-together.small-web.org; tutorial: https://kitten.small-web.org/tutorials/streaming-html/)
• Kitten Kawaii (https://kitten-kawaii.small-web.org/character/blissful/granny-smith-apple/cat/, write up: https://ar.al/2024/08/19/kitten-kawaii-porting-a-react-library-and-next-js-web-site-to-kitten/)
• Streamiverse¹ (https://streamiverse.small-web.org, tutorial: https://kitten.small-web.org/tutorials/htmx-the-htmx-web-socket-extension-and-socket-routes/)
And you can find a host of little examples in the codebase:
https://codeberg.org/kitten/app/src/branch/main/examples
Hope that helps. Until the Small Web stuff is publicly released I don’t really foresee a lot of folks using it. Although I know a few people are playing with it.
¹ Just noticed I need to improve it so it recaches profile images if they’ve changed. Noticed a couple of broken ones.
New Kitten release
• Live events view in //settings/state/pages
• Fix automatic event handler binding
I’ve also updated the Kitten Count example in the Streaming HTML tutorial to use the new, simpler, event handler syntax in the improved (and experimental) Kitten component model. There’s more to the latter (e.g., class-based routes) that’s not documented yet but will be soon.
https://kitten.small-web.org/tutorials/streaming-html/#o-counter-my-counter
Enjoy!
Streamiverse is written in Kitten and you can follow the “htmx, the htmx WebSocket extension, and socket routes” tutorial to create a Kitten app that consumes the API:
https://kitten.small-web.org/tutorials/htmx-the-htmx-web-socket-extension-and-socket-routes/
To get started with Kitten, see:
(Could be a fun little thing to play with this weekend.)
In #Signal v7.17.0 (Android) they've introduced #SignalNetwork. Seems like a self-made Push replacement for #websocket to me. Unfortunately I can't find any info about it online. Can somebody tell me more?@SignalUpdateInfo @signalapp
https://github.com/signalapp/Signal-Android/commit/00d20a19178e3489934284b2e9d50b8ec96b2806
#CaseStudy - discover how #Canva implemented real-time mouse pointers for collaborative whiteboarding!
Using #WebRTC, they've improved scalability, reduced latency, and lowered backend load.
Read more on #InfoQ https://bit.ly/4dhJvYM
Details on the evolution of Pushy by #Netflix!
Netflix’s engineers implemented numerous improvements across the Pushy ecosystem to ensure the platform's scalability and reliability and support new capabilities.
Dive into the tech behind this #WebSocket messaging platform: https://bit.ly/3BdWoG6
#InfoQ #Performance #Scalability #Microservices #SoftwareArchitecture
Is it possible for websocket URIs (ws://
and wss://
) to have username/password or a fragment component? I know they are technically URIs, but in practice does that ever happen?
#uri #websocket
Kitten¹ update
I just added a new htmx header to #WebSocket messages in Kitten that contains the actual event type (name) that triggered the message.
This is useful, for example, if your trigger is a horizontal swipe and you need to differentiate between whether it was a swipe left or a swipe right that caused it.
Upstream issue: https://github.com/bigskysoftware/htmx-extensions/issues/74
Upstream merge request: https://github.com/aral/htmx-extensions/commit/359da12563fd0ef6709d801972f98ba1ab61c302
Enjoy!