Skip to content

Client disconnects on Session Auth Error #1189

@jake-strive

Description

@jake-strive

We have had some transient errors that threw a SessionAuthError and then disconnects the client using valid credentials.

We are working around this by utilizing the client exposed by the package, but appears undocumented at https://developer.signalwire.com/sdks/reference/realtime-sdk/relay-v4.

import { SignalWire } from "@signalwire/realtime-api";

const relayClient = await SignalWire({ project: "ProjectID Here", token: "Token Here" })

const client = relayClient.client

const onAuthError = async () => {
  // do something when authError is thrown
}

// is the client session connected?
if (client?.store?.getState?.()?.session?.authStatus === 'authorized') { 
  // handle state when session throws an authError instead of silently disconnecting.
  client.session.addListener('session.auth_error', onAuthError)
}

Is utilizing this client in such a way considered supported? If not, are their plans to expose session events like session.auth_error and the current session authStatus?

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions