Skip to content

Missing Details/Unexpected behaviour Authenticating over Websocket using graphql-ws. #1756

@Efosaok

Description

@Efosaok

Bug Report

The section of the documentation on authentication over websocket says that the data returned from forRoot.subscriptions.['subscription-transport-ws' || 'graphql-ws'].onConnect callback will be acessible in the forRoot.context callback via connection.context. However that doesn't seem to be the case at least for graphql-ws. connection is undefined in context regardless of what is returned from onConnect.

Irrespective of what was returned from forRoot.subscriptions.[graphql-ws'].onConnect, I was only able to access the connectionParams parsed from the client via context directly like this

{
  context: ({ connectionParams, connection }) => { } // connection will evaluate to undefined while connectionParams hold necessary authentication parameters. 
}

I am not sure if this is the intended behaviour and was missed out on the documentation or a bug but I am sure someone else will experience this soon enough.

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