I wrote /dev/push [1] with FastAPI + HTMX + Alpine.js, and I'm doing a fair bit with SSE (e.g. displaying logs in real time, updating state of deployments across lists, etc). Looking at the Datastar examples, I don't see where things would be easier that this [2]:
<div
hx-ext="sse"
sse-connect="{{ url_for('project_event', team_id=team.id, project_id=project.id) }}"
sse-close="sse:stream_closed"
>
<div
hx-trigger="sse:deployment_creation, sse:deployment_status_update, sse:deployment_rollback, sse:deployment_promotion"
hx-get="{{ url_for('project_deployments', team_slug=team.slug, project_name=project.name).include_query_params(fragment='deployments') }}"
hx-target="#deployments"
></div>
</div>
Also curious what others think of web components. I tried to use them when I was writing Basecoat [3] and ended up reverting to regular HTML + CSS + JS. Too brittle, too many issues (e.g. global styling), too many gaps (e.g. state).[1]: https://devpu.sh
[2]: https://github.com/hunvreus/devpush/blob/main/app/templates/...