DEV Community

loading...

Discussion on: Why you should care about PWA

Collapse
zoedreams profile image
☮️✝️☪️🕉☸️✡️☯️

PWA are great, however its important to take into consideration of building and learning how to utilize push technology to make for responsive design. Limiting yourself to 200ms response times are important to make your PWA feel like a desktop app verses just a website.

one type of architecture I have had great success with to exponetially decrease response times is to employ a hybrid RESTful push system.. Meaning have one traditional REST like api that allows for requests, and then use a push mechanism with socket.io to send the response over a persistent connection. This eliminates the need to construct response headers..

For example the PWA makes a rest call, the server processes it then forwards its response through a persistent connection (or rest) on a socket.io server that is a peer to it on the same LAN / router. the push server forwards the rest server response to the client. The client creates a unique guid for each rest request, and will be awaiting the push response with a simple async function. you put the request into a request call stack which pops off the request callback when the socket io push response comes in. this technique provides the speed of websockets while still using a tradition rest api. super fancy -- however it requires setting up a socket io push server. also reduces bandwidth and load on your rest server.

github.com/ZoeDreams/talk

Collapse
tomburgs profile image
Toms Burgmanis Author

Sounds like an interesting idea :)

I think it could work more neatly with a GraphQL API as it has subscriptions, have you ever tried it?

Collapse
zoedreams profile image
☮️✝️☪️🕉☸️✡️☯️

yes, and that works great with that, and other big data or real time applications.

Collapse
dreplica profile image
dreplica

Absolutely