Prim+RPC exports two primary functions:
createPrimServer(). Both functions take a
configuration object as their only argument and the server configuration extends the client configuration.
The Prim+RPC server is the tool that transforms requests into RPC and RPC results into responses. It is a misnomer as it is not a server per se but is a framework agnostic utility to work with the server of your choice.
It works with the server of your choice through handler plugins: the method handler handles method calls, the callback handler optionally handles callbacks on those methods. They are separate plugins because of their design: while the method handler has a single response for every request (a function result for every call), the callback handler can return multiple responses for a request (because callbacks can be fired multiple times).
This function is given a single argument which is its configuration. You may reference server options for more details.
This function takes a type parameter (if using TypeScript) that is the type of the module given to the server. It also takes a single argument which is the client configuration. You may reference shared options for more details.
The test plugins apply similar transformations to and undergo the same events as other plugins but are sent using local event handlers. This is useful in environments like Jest and Vitest where you would otherwise have to emulate the separated environments.Report an Issue