Chapter 27

State Watch

Notify clients when specific values change on the server.

Problem

Clients are interested in changes to the specific values on the server. It’s difficult for clients to structure their logic if they need to poll the server continuously to look for changes. If clients open too many connections to the server for watching changes, it can overwhelm the server.

Solution

Allow clients to register their interest with the server for specific state changes. The server notifies the interested clients when state changes happen. The client maintains a Single-Socket Channel with the server. The server sends state change notifications on this channel. Clients might be interested in multiple values, but maintaining a connection per ...

Get Patterns of Distributed Systems now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.