The service worker can also communicate with the webpage/app using messages. The SW and page/app run as separate entities as a security measure, but the webpage can register with the SW as a client (each tab can do this individually) and then they can communicate via messages. There is a Subscription in the RP code to manage receiving SW messages