Closed camopy closed 1 year ago
There is a channel only for the root level resolver. Any time this channel sends a message the entire response is sent to the client, e.g. {"data":"..."}
. This is not an issue with the library but rather how subscriptions are handled.
The SubscriptionResolver's method is failing with a missing method error when trying to return a channel instead of a pointer.
The issue is related to subscriptions and their implementation with a nested resolver structure.
So I'm a bit confused, do subscriptions only work on the "root" resolver?
Or does it work with the following structure somehow?
The following error is thrown when building the project:
PANIC panic {"panic": "<-chan *market.TokenUpdatedEvent does not resolve \"TokenUpdatedEvent\": missing method for field \"tokenUpdated\"\n\tused by (*market.SubscriptionResolver).Token\n\tused by (*v2.PublicRootResolver).MarketSub"}
The project builds up if I use the following method signature:
func (r *SubscriptionResolver) Token(ctx context.Context) *TokenUpdatedEvent {
But afaik, the correct for subscriptions is to return a channel, but then it fails:
func (r *SubscriptionResolver) Token(ctx context.Context) <-chan *TokenUpdatedEvent {