CustomDataChannelObserver Protocol Reference

Conforms to NSObject
Declared in CustomDataChannel.h

Overview

A class can implement the Observer protocol when it wants to be informed of events in CustomDataChannel objects.

– onConnected: required method

This method is called when the listened CustomDataChannel is connected successfully.

- (void)onConnected:(NSInteger)port

Parameters

port

The identify of the listened CustomDataChannel.

Discussion

This method is called when the listened CustomDataChannel is connected successfully.

Declared In

CustomDataChannel.h

– onError:code:message: required method

This method is called whenever some error is happened in the listened CustomDataChannel.

- (void)onError:(NSInteger)port code:(NSInteger)code message:(NSString *)msg

Parameters

port

The identify of the listened CustomDataChannel.

code

The error code.

msg

The error message.

Discussion

This method is called whenever some error is happened in the listened CustomDataChannel.

Declared In

CustomDataChannel.h

– onMessage:buffer: required method

This method is called whenever the listened CustomDataChannel receives cloud message.

- (void)onMessage:(NSInteger)port buffer:(NSData *)buffer

Parameters

port

The identify of the listened CustomDataChannel.

buffer

The message sent from the cloud.

Discussion

This method is called whenever the listened CustomDataChannel receives cloud message.

NOTE: |buffer.data| will be freed once this function returns so callers who want to use the data asynchronously must make sure to copy it first.

Declared In

CustomDataChannel.h