Absinthe: Handle Sec-Websocket-Protocol response header for Apollo client

Created on 1 Jan 2019  路  3Comments  路  Source: absinthe-graphql/absinthe

If submitting a bug, please provide the following:

Environment

  • Elixir version (elixir -v): 1.7.4
  • Absinthe version (mix deps | grep absinthe): 1.4.13
  • Client Framework and version (Relay, Apollo, etc): Apollo

Expected behavior

Connect to Absinthe GraphQL websocket with Apollo from Vue app and handling the Sec-Websocket-Protocol header.

Actual behavior

WebSocket connection to 'ws://localhost:4000/ws/websocket' failed: Error during WebSocket handshake: Sent non-empty 'Sec-WebSocket-Protocol' header but no response was received

Imgur

The Apollo client sends the Sec-WebSocket-Protocol: graphql-ws header, but the Absinthe server doesn't handle this and doesn't return the Sec-Websocket-Protocol header.

Most helpful comment

The core absinthe project doesn't concern itself with any transport. Right now the only websocket based transport that exists is in absinthe_phoenix which expects the client to use the phoenix channels library. You can find an integration here https://github.com/absinthe-graphql/absinthe-socket/tree/master/packages/socket-apollo-link

If you don't want to use that package then you'll need to write a handler for the apollo specific protocol.

All 3 comments

The core absinthe project doesn't concern itself with any transport. Right now the only websocket based transport that exists is in absinthe_phoenix which expects the client to use the phoenix channels library. You can find an integration here https://github.com/absinthe-graphql/absinthe-socket/tree/master/packages/socket-apollo-link

If you don't want to use that package then you'll need to write a handler for the apollo specific protocol.

As a side-note, it also breaks things that are powered by Apollo that are made by third parties, like Altair GraphQL client.

@ivan-kolmychek as noted before, this is the wrong project for this kind of issue. Absinthe does not do transports.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maennchen picture maennchen  路  6Comments

safwank picture safwank  路  4Comments

boxxxie picture boxxxie  路  5Comments

ndarilek picture ndarilek  路  5Comments

UnderFenex picture UnderFenex  路  3Comments