Skip to content

Update auth header on Websocket connection, automatic reconnect of subscription? #1178

@gazzer82

Description

@gazzer82

I have this working in a project to a Hasura backend using subscriptions. I am authenticating by adding an ID Token from google auth to the connectingPayload.

The validity of the ID token from google is 1 hour, and I am trying to honour that in Hasura with only allowing the connection to remain valid for the remaining validity of the token when received.

Unfortunately that means I need to change the token in the payload when it has expired, and reconnect the web socket.

I am currently thinking the only way to do this is to create a new WebSocketTransport in

func webSocketTransport(_ webSocketTransport: WebSocketTransport, didDisconnectWithError error:Error?)

But the problem is I have some active subscriptions going on when this happens, and they don't reconnect unless manually made to do so.

Am I missing something here, or is their no easy/clean way way to handle the currently in the framework?

Thanks

Gareth

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions