Getting Started

Before using PSPDFKit Instant with PSPDFKit for Web, make sure a PSPDFKit Server is running and PSPDFKit for Web is connected to the server. After that, enabling Instant on PSPDFKit for Web is very simple. All you have to do is set the Instant flag in the configuration object to true:

1
PSPDFKit.load({ instant: true, ... });
1
PSPDFKit.load({ instant: true, ... });

Listening for Client Updates

PSPDFKit Instant comes with an additional set of APIs to utilize the power of real-time collaboration. This includes an API to receive updates whenever new clients connect to the document, as well as an API to access all currently connected clients.

Both methods return an Immutable.Map of InstantClients:

Copy
1
2
3
4
5
instance.connectedClients.count(); // => 12

instance.addEventListener("instant.connectedClients.change", clients => {
  console.log(clients.toJS());
});
Copy
1
2
3
4
5
6
7
instance.connectedClients.count(); // => 12

instance.addEventListener("instant.connectedClients.change", function(
  clients
) {
  console.log(clients.toJS());
});