Two primary questions:
a) Does Elm support HTTP/2 and SSE?
b) How best to serve an Elm PWA?
If we wanted to build an Elm PWA using a stack that consists of:
- elm PWA
- elm http2/3 + SSE
- http2/3 + SSE endpoint (HTTP/1 disabled)
- graphql endpoint (Hasura + postgresql)
The reasoning behind choosing HTTP2/3 + SSE over Websockets:
- Using SSE Instead Of WebSockets For Unidirectional Data Flow Over HTTP/2
- Combining HTTP/2 and SSE provides efficient HTTP-based bidirectional communication
The intention is to use modern technology (GraphQL, Elm!, HTTP/2, SSE) to avoid heavy reliance on a traditional web backend (node, express, etc), simplify implementation and create a types-without-borders pipeline from UI to DB.
- Does elm/http support HTTP/2 and will it support HTTP/3 ?
- Does elm/http support SSE?
- If not, how would we implement HTTP2/3 + SSE in Elm?
- What would be the best way to hydrate the elm UI into browsers or into a PWA?
The PWA is to help field technicians capture all types of tasks on to a phone or laptop. The technicians work in data centers and each task has a start and a stop time, data center location, date, categories and comments.
There are two options for hosting the PWA:
- somewhat self-managed infrastructure like Digital Ocean with Hasura GraphQL
- fully serverless infrastructure that may or may not give me the stack I want (maybe no Hasura).
if somewhat self-managed infrastructure:
- Hasura can be used as the GraphQL endpoint with Postgres database underneath.
- Authentication and authorization can be handled by Hasura and brokered by Auth0 (all users have Google accounts created for them and will authenticate with those).
- All routing is done by Elm and nothing on the server other than for hydration.
- Once hydrated (PWA installed on mobile or cached in browser) only updates will be required.
- Not sure about interactive file uploads, or serving images or svg elements used in the UI. Field techs need to upload images taken of receipts.
General questions about hosting and architecture. The goal is to keep it as simple as possible. The app will be mostly rendered HTML and CSS (via elm-ui):
- Do I just need to run something like NGINX as web server?
- Should I think of serving to a PWA as being just like serving to a website except much lighter weight on the backend? This is a question about infrastructure and pipeline complexity.
- Should I consider choosing a serverless provider that offers Hasura, HTTP2/3, SSE, web serving and CDN?
- Dillon Kearns’ Elm Pages seems like it could solve a lot of challenges. Maybe combining:
Hosting the app on Netlify and the Hasura endpoint on either Digital Ocean or Heroku. Authentication could likely also be provided by Netlify. Unfortunately still no Hasura hosting on Netlify.