Confirmed users
230
edits
(→Bridge) |
|||
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 /> | ||
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. | |||
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 | 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 | 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: |