Registering a custom service worker on the IC

A few years back, i remember being informed by @peterparker in this post that Dapps on the IC can’t register custom service workers without implementing some sort of workaround.

I’m wondering if this limitation has been removed. I have a Progressive Web App that I would like to add push notifications to. To do this, I’ll need to be able to register a custom service worker for the PWA.

Are Dapps able to register custom service workers on the IC? If so, are there any steps specific to the IC that must be implemented in order to create a custom server worker?

Lastly, can anyone link a reference to an example of a custom server worker running on the IC?

Thank you in advance.

I actually never tried, but I think the limitation I mentioned 1.5 years ago has been lifted by removing the “certification service worker” on the client side - i.e. you should be able to register your own service worker shipped with your dapp assets.

Off the top of my head, I’d say there’s nothing specific to the IC, so I’d guess that most examples should work.

1 Like

Yep, this limitation has been lifted. Using service workers now is the same on the IC as it is on any other frontend application.

The first example of one I can think of is openchat.

2 Likes

Thank you. I’m gonna give it a try. I’ll post any pertinent discoveries here for anyone else looking to implement a service worker on the IC

1 Like

Thank you. Very much appreciated!

Super.

Not an example but, if it can be useful, libs like workbox makes life / service worker implementation a bit easier.

1 Like

Awesome, thanks @peterparker !

1 Like