public static interface CustomDataChannel.Observer
Observer interface when it wants to be informed of events
in CustomDataChannel objects.| Modifier and Type | Method and Description |
|---|---|
void |
onConnected(int port)
This method is called when the listened
CustomDataChannel is connected successfully. |
void |
onError(int port,
int code,
java.lang.String msg)
This method is called whenever some error is happened in the listened
CustomDataChannel. |
void |
onMessage(int port,
java.nio.ByteBuffer buffer)
This method is called whenever the listened
CustomDataChannel receives cloud message. |
void onConnected(int port)
CustomDataChannel is connected successfully.port - The identify of the listened CustomDataChannel.void onError(int port,
int code,
java.lang.String msg)
CustomDataChannel.port - The identify of the listened CustomDataChannel.code - The error code.msg - The error message.void onMessage(int port,
java.nio.ByteBuffer buffer)
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.
port - The identify of the listened CustomDataChannel.buffer - The message sent from the cloud.