Communication Patterns
System-wide Broadcasting
// Weather monitoring service broadcasts a system-wide alert
weatherMonitor.broadcast({
type: "severe-weather",
payload: {
condition: "hurricane",
region: "Gulf Coast",
expectedImpact: "severe",
timeframe: "36 hours",
},
});
// Any node in the system can listen for these alerts
emergencyServices.on(type => type === "severe-weather", event => {
deployEmergencyTeams(event.payload.region);
});Direct Communication
Request-Response Pattern
Response Handling with Callbacks
Fire-and-Forget Communication
Implicit Contracts
Choosing the Right Pattern
Last updated