Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subscription.SendData does not include errors when sending JSON over websocket #30

Open
david4shure opened this issue Jun 11, 2018 · 0 comments
Labels

Comments

@david4shure
Copy link

david4shure commented Jun 11, 2018

So I have configured a subscription manager, and it is successfully creating subscriptions, but I wanted to validate certain variables that are sent over with the Subscription when it is created. If they aren't valid, I execute the following code:

data := graphqlws.DataMessagePayload{
	Errors: []error{errors.New("subscription failed: invalid.")},
}
sub.SendData(&data)

This is all well and fine, except that the message that is getting written out to the websocket looks like this:

{"id":"dave","type":"data","payload":{"data":null,"errors":[{}]}}

I certainly expected the data key in the payload to be null or empty, but I expect the errors to be written out to the errors key in the payload JSON instead of being [{}]. Am I doing something wrong here?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants