nextspace
    Preparing search index...

    Function emitWithTokenRefresh

    • Wraps a WebSocket emit operation with automatic token refresh on authentication errors. If the socket returns an authentication error, it will attempt to refresh the token and retry the operation once.

      Parameters

      • socket: any

        The socket.io socket instance

      • event: string

        The event name to emit

      • data: any

        The data to send with the event

      • OptionalonSuccess: () => void

        Optional callback for successful emission

      • OptionalonError: (error: any) => void

        Optional callback for errors (after retry if applicable)

      Returns Promise<void>