[w3c/manifest] Add a manifest option for the declaration of the web application running pattern (Issue #1019)

We found that when we are having multiple instances of a PWA simultaneously, a race condition would occur that corrupts local data and causes undefined behaviors.

We will use [Sudoku Game PWA](https://sudoku.jull.dev/) to illustrate the problem we detected. Sudoku Game PWA would automatically save unfinished games after closing and reload the unfinished game when reopening. The unfinished game would be stored on our local machines.

- Scenario I: When we only have one Sudoku Game PWA running, the application runs perfectly without any problems including saving and reloading.

- Scenario II: When we have two running Sudoku Game PWAs named Sudoku A and Sudoku B, we can play two games at the same time normally. However, if we close Sudoku A first, then close Sudoku B, we can only reload the game played by Sudoku B from newly created Sudoku PWAs.

After exploring our local files, we determined that Sudoku B had overwritten the data saved by Sudoku A. 

On operating systems level, some applications are designed to have only one running instance. Most noteable such applications are web browsers such as Firefox and Chrome. Some PWAs should also be restricted from having multiple instances for various reasons.

Therefore, it is curial to add pattern member to the current manifest standards which helps PWA and browser developers alike to better handle multi-instance PWAs and single-instance PWA concurrently.

The proposal here is for a new optional "pattern" member to be added to the manifest. The default value of this member is "non-singleton" for PWAs that are expected to have multiple instances. This member is setted to "singleton" for single-instance-only PWAs.

(We have considered the naming of the manifest member, including "mode" and "instance", and finally decided that "pattern" is more suitable.)

Below is the recommended member and value set for the manifest:

```
{
  "pattern": "singleton" // enum: non-singleton(default), singleton
}
```

-- 
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/manifest/issues/1019

Received on Thursday, 28 October 2021 03:08:51 UTC