RPC Docs.
These are the currently supported plugins and handlers for Prim+RPC. This guide is slightly different from Client Plugins and Server Plugins in that the client and server may be on the same machine. For each framework below, all of the possible plugins for that framework will be given.
For | Plugin Type | Transport Type |
---|---|---|
Web Workers, Shared Workers | Method and callback plugin/handler | Web Worker |
You can communicate between a Web Worker and the main thread in either direction, or both, like so (both Dedicated and Shared Workers are supported):
Note that the web worker plugin has a jsonHandler
export. This is just a helper utility that will disable JSON
handling. JSON handling should be disabled because Web Workers will use
structured cloning
instead which is far more powerful. Of course, you can always override the JSON handler to anything that you'd like if
you can forgo structured cloning.
For | Plugin Type | Transport Type |
---|---|---|
Testing (Vitest, Jest, etc.) | Method and callback plugin/handler | Local (Same File) |
It's easy to use Prim+RPC in a single file by communicating over a generic event handler. Use like so:
Note that the results of createPrimTestingPlugins()
must be passed to both the Prim+RPC server and client because they
are linked during setup.
For | Plugin Type | Transport Type |
---|---|---|
Node | Method and callback plugin/handler | Child Process |
Unavailable (planned)
For | Plugin Type | Transport Type |
---|---|---|
Electron | Method and callback plugin/handler | Electron |
Unavailable (planned)