Subscriptions

Using subscriptions, a client an can get updates on different events. The client holds a persistent connection to the server and the server streams data to the client.

For example, if we want to know of newly created hotels as a client, it can send a subscription like so:

subscription { 
  newHotel { 
    name 
    id 
  } 
} 

After this, a connection is opened between them. Then, whenever a new mutation is performed that creates a hotel, an event in the following form is streamed to the interested client:

{ 
  "newHotel": { 
    "name": "Taj", 
    "id": cdab123 
  } 
} 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset