Re: [w3c/ServiceWorker] Should EventSource and WebSocket be exposed in service workers? (#947)

Hi all,

So I have a requirement where I need to get intermittent push messages from the server to inside a service worker. And it should work in flaky network conditions. I was thinking of creating a websocket inside the service worker and listen for any updates. But that does not seem to be the recommendation here.

I am wondering what is the ideal way to achieve this now. Using [web push notifications](https://developers.google.com/web/fundamentals/engage-and-retain/push-notifications/) is an option that I am considering. However it seems pretty convoluted to set up.

> EventSource is not deprecated, but you can do everything it can do with Fetch

@annevk - can you explain how that will work when a server wants to push something to the client ? As far as I understand, its a successor to our beloved xhr. But its still a simple request-response API.

I am thinking of using EventSource in the main app code outside of service worker and have a message passing mechanism to trigger the service worker when I receive an event.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/947#issuecomment-304901139

Received on Tuesday, 30 May 2017 14:45:31 UTC