MessageClient.RpcService
Stay organized with collections
Save and categorize content based on your preferences.
Known Indirect Subclasses
|
Public Methods
public abstract Task<byte[]>
onRequest (String nodeId, String path, byte[]
request)
Called when an RPC request is received.
Parameters
nodeId |
node ID of the sender |
path |
the path at which the RPC request was received |
request |
the data associated with the RPC request |
Returns
- a future containing the response to be delivered back to the sender. null if the
request is not handled by this
MessageClient.RpcService
.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["`MessageClient.RpcService` is an interface used to handle incoming RPC requests on wearable devices."],["It's used with `MessageClient.addRpcService()` to register a service for receiving RPCs."],["Implement the `onRequest()` method to define how your service responds to incoming requests."],["For background event handling, consider using `WearableListenerService` instead."]]],["`MessageClient.RpcService` receives incoming RPC requests. Use `MessageClient.addRpcService` to register it. `WearableListenerService` is used to receive background events like data changes. The core method, `onRequest`, is triggered upon receiving an RPC request. It provides the sender's node ID, the request path, and associated data. `onRequest` returns a `Task` containing the response for the sender or null if unhandled.\n"]]