Skip to content

Separate variables in subscription #330

@boxmein

Description

@boxmein

What happens

Qminder.graphql.subscribe(query) does not accept a second, optional argument for variables.

What should happen

Qminder.graphql.subscribe(query, variables) should accept a second, optional argument variables which it passes to the GQL_START message and sends to the backend: https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md#gql_start

Why

  • It's best practice to send variables next to the query document, instead of injecting them with string interpolation
  • Prevents GraphQL injections during runtime
  • Makes writing complex or parameterized functions clearer
  • Helps utilize modern tooling such as graphql-tag which disallows string interpolation into queries

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions