andyrichardson / subscriptionless

GraphQL subscriptions (and more) on serverless infrastructure
MIT License
93 stars 3 forks source link

Add batching by topic for published events #1

Open andyrichardson opened 3 years ago

andyrichardson commented 3 years ago

About

Resolvers should be called with an array of events (due to batching of events).

Note: Needs exploration to see if this is necessary and/or common practice

Example

Before

{
 // ...
  resolve: (event) => {
    console.log(event) // { topic: 'MY_TOPIC', payload: {} }
  }
}

After

{
 // ...
  resolve: (events) => {
    console.log(events) // [{ topic: 'MY_TOPIC', payload: {} }]
  }
}