Gaia/Architecture Proposal: Difference between revisions

Line 267: Line 267:
The clients can call remote methods on the server, and can subscribe to events. The server API is defined in a separated strict contract file.<br />
The clients can call remote methods on the server, and can subscribe to events. The server API is defined in a separated strict contract file.<br />


The client does not need to know who is going to resolve the contract. As a result servers can either be Windows, Workers, SharedWorkers or even a ServiceWorker.
None of the sides needs to know what is the context that runs the code of the other side. So the client does not need to know who is going to resolve the contract, nor the server needs to known who are its clients.


It can also be used by a Worker (as a Client) to access Main-thread only WebAPIs via the bridge channel.<br />
As a result clients and servers can either be Windows, Workers, SharedWorkers or ServiceWorkers.


The contract defined between a client and a server define the methods and events available, has strong types, offer a place to record the communication for debugging purpose, can measure the latency of responses and fire a telemetry report, ...
The bridge can also be used by a Worker (as a Client) to access Main-thread only WebAPIs.
 
The contract defined between a client and a server define the methods and events available. The contract is built with a few additional features:
* Strong types
* debug mode
* Communication recording for debugging purpose
* Method calls latency
* ...


The contract for a specific service can have multiple versions in order to allow older clients to works with the newly server code.
The contract for a specific service can have multiple versions in order to allow older clients to works with the newly server code.
Line 299: Line 306:


''
''
Note: The contract resolution is asynchronous since the server may not run when the client asks for a service. But the API is abstracting that so you can call methods even if the server is not running yet.''
Note: The contract resolution is asynchronous since the server may not run when the client asks for a service. But the API is abstracting that so developers can call methods even if the server is not running yet.''


Server side usage example:
Server side usage example:
Confirmed users
230

edits