How to publish events from background jobs (outside of graphql server) for subscribers of the graphql server

I want to publish events outside of graphql server for the subscribers. But the subscribers are not aware when the event is published outside of graphql server they can only hear events when it is published from graphql servers via mutation. I am using:

  • apollo server with express middleware

  • graphql-ws

  • graphql-redis-subscriptions