Any way to create custom subscriber? #496
-
We have a pretty detailed description of how to create custom driver but does exist any way to create such a custom driver for event-based transport? The current GraphQL subscriber looks like
It means that the subscriber is WebSocket based and a URL is required. But what if we want to use e.g. EventEmitter as a source events, do we have any way for it? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Interesting topic. Indeed a custom driver is about implementing not only some custom behaviour, but you can do anything you like, even connect to an external API library, or work on pure promises, whatever you want. Subscribers are a little different, like you noticed, it already assumes WebSocket protocol. Creating subscriber of your own is about making it compatible with your WS server, be it GraphQL or anything else. It would be cool to make it support anything, but currently only WS are possible. But, there is a hope. Perhaps it would be possible to create a WS adapter class? As you can see, you can pass |
Beta Was this translation helpful? Give feedback.
Interesting topic. Indeed a custom driver is about implementing not only some custom behaviour, but you can do anything you like, even connect to an external API library, or work on pure promises, whatever you want. Subscribers are a little different, like you noticed, it already assumes WebSocket protocol. Creating subscriber of your own is about making it compatible with your WS server, be it GraphQL or anything else. It would be cool to make it support anything, but currently only WS are possible.
But, there is a hope. Perhaps it would be possible to create a WS adapter class? As you can see, you can pass
WS
tocreateSubscriber
. What about trying to make a class implementing WS interfa…