Skip to content

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

Description

@david4shure

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions