HYPNetworkObserver

@protocol HYPNetworkObserver <NSObject>

@abstract Network observer.

@discussion Network observers handle network events, such as instances being found and lost on the network.

  • @abstract Notification issued when an instance is found on the network.

    @discussion This notification is issued when an instance is found on a matching realm. At this point communication with the given instance should already be possible, even though it will not be secure (not encrypted or authenticated). The instance’s announcement should help identify whether the instance is interesting and, if so, a session should be started with it. After the session is started communication will be encrypted. Your app should keep track of found instances (and clear them when they are lost) as these instances will be necessary in order to send messages.

    Declaration

    Objective-C

    - (void)hype:(HYP *)hype didFindInstance:(HYPInstance *)instance;

    Swift

    func hype(_ hype: HYP!, didFind instance: HYPInstance!)

    Parameters

    hype

    The HYP singleton instance.

    instance

    The found instance.

  • @abstract Notification issued when an instance is lost on the network.

    @discussion This notification is issued when a previously found instance is lost, such as it going out of range, or the adapter being turned off. The error parameter indicates the cause for the loss. When a cause cannot be properly determined the framework uses a probable one instead, usually indicating that the device appeared to go out of range.

    Declaration

    Objective-C

    - (void)hype:(HYP *)hype
        didLoseInstance:(HYPInstance *)instance
                  error:(NSError *)error;

    Swift

    func hype(_ hype: HYP!, didLose instance: HYPInstance!, error: Error!)

    Parameters

    hype

    The HYP singleton instance.

    instance

    The lost instance.

    error

    An error (NSError) describing the cause for the loss.