IVSRealTimeConnection

Objective-C


@interface IVSRealTimeConnection : NSObject

Swift

class IVSRealTimeConnection : NSObject

A shared connection that multiple IVSStage instances can use to communicate with the IVS real-time service over a single physical network transport.

You can create an IVSRealTimeConnection, pass it to one or more IVSStage instances, and then call join on any of those stages. If you have not yet called connect() on the connection, the SDK auto-connects it the first time a stage calls join. You can also call connect() explicitly before joining any stage to establish the transport in advance which will cause future stage joins over this connection to connect faster.

  • Unavailable

    Do not create instances of this class directly

    Declaration

    Objective-C

    IVS_INIT_UNAVAILABLE
  • Unavailable

    Do not create instances of this class directly

    Declaration

    Objective-C

    IVS_INIT_UNAVAILABLE
  • A delegate that receives connection state changes.

    Declaration

    Objective-C

    @property (nonatomic, weak) id<IVSRealTimeConnectionDelegate> _Nullable delegate;

    Swift

    weak var delegate: (any IVSRealTimeConnection.Delegate)? { get set }
  • Creates a connection with the provided connection token.

    Throws

    An error describing why initialization failed.

    Declaration

    Objective-C

    - (nullable instancetype)initWithToken:(nonnull NSString *)token
                                     error:(NSError *_Nullable *_Nullable)outError;

    Swift

    init(token: String) throws
  • Opens the connection to the IVS Real-Time service.

    You do not need to call this method before joining a stage. If the connection is not yet open when a stage calls join, it is opened automatically. Call this method explicitly if you want to establish the transport before joining any stage — for example, to reduce time-to-video.

    Throws

    An error describing why the connection could not start.

    Declaration

    Objective-C

    - (BOOL)connect:(NSError *_Nullable *_Nullable)outError;

    Swift

    func connect() throws
  • Closes the connection. This will leave any connected Stage, and will prevent any unconnected Stages from joining.

    Declaration

    Objective-C

    - (void)disconnect;

    Swift

    func disconnect()