{"id":48362112,"url":"https://github.com/ixacik/expo-watch-connectivity","last_synced_at":"2026-04-21T03:01:26.529Z","repository":{"id":329762938,"uuid":"1120602074","full_name":"ixacik/expo-watch-connectivity","owner":"ixacik","description":"Expo module wrapping Apple's WatchConnectivity framework for seamless communication between React Native/Expo apps and Apple Watch apps.","archived":false,"fork":false,"pushed_at":"2026-01-21T10:14:16.000Z","size":190,"stargazers_count":18,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-21T21:58:14.751Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ixacik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-21T15:06:59.000Z","updated_at":"2026-01-21T10:14:20.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ixacik/expo-watch-connectivity","commit_stats":null,"previous_names":["ixacik/expo-watch-connectivity"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ixacik/expo-watch-connectivity","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ixacik%2Fexpo-watch-connectivity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ixacik%2Fexpo-watch-connectivity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ixacik%2Fexpo-watch-connectivity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ixacik%2Fexpo-watch-connectivity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ixacik","download_url":"https://codeload.github.com/ixacik/expo-watch-connectivity/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ixacik%2Fexpo-watch-connectivity/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32074812,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T02:38:07.213Z","status":"ssl_error","status_checked_at":"2026-04-21T02:38:06.559Z","response_time":128,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-05T13:00:29.645Z","updated_at":"2026-04-21T03:01:26.524Z","avatar_url":"https://github.com/ixacik.png","language":"TypeScript","funding_links":[],"categories":["Frameworks \u0026 Platforms"],"sub_categories":["Graphics \u0026 Drawing"],"readme":"# @plevo/expo-watch-connectivity\n\nExpo module wrapping Apple's WatchConnectivity framework for seamless communication between React Native/Expo apps and Apple Watch apps.\n\n## Installation\n\n```bash\nnpx expo install @plevo/expo-watch-connectivity\n```\n\n## Usage\n\n```typescript\nimport { WatchConnectivity } from '@plevo/expo-watch-connectivity';\n\n// Activate the session (required before any communication)\nawait WatchConnectivity.activate();\n\n// Check if Watch is reachable for real-time messaging\nif (WatchConnectivity.sessionState.isReachable) {\n  const reply = await WatchConnectivity.sendMessage({ action: 'ping' });\n  console.log('Watch replied:', reply);\n}\n\n// Listen for incoming messages\nconst subscription = WatchConnectivity.addMessageListener(({ message, replyId }) =\u003e {\n  console.log('Received from Watch:', message);\n  \n  // Reply if the Watch expects a response\n  if (replyId) {\n    WatchConnectivity.replyToMessage(replyId, { status: 'ok' });\n  }\n});\n\n// Background sync via application context (latest-wins)\nawait WatchConnectivity.updateApplicationContext({\n  theme: 'dark',\n  lastSync: Date.now(),\n});\n\n// Background transfer via user info (queued FIFO)\nWatchConnectivity.transferUserInfo({ notification: 'New data available' });\n\n// File transfer\nWatchConnectivity.transferFile('/path/to/file.pdf', { name: 'Document' });\n\n// Cleanup\nsubscription.remove();\n```\n\n## API Reference\n\n### State Properties\n\n| Property | Type | Description |\n|----------|------|-------------|\n| `isSupported` | `boolean` | Whether WatchConnectivity is supported (always `false` on Android) |\n| `sessionState` | `SessionState` | Current session state including pairing, reachability, etc. |\n| `applicationContext` | `Record\u003cstring, unknown\u003e` | Most recently sent application context |\n| `receivedApplicationContext` | `Record\u003cstring, unknown\u003e` | Most recently received application context |\n| `outstandingUserInfoTransfers` | `UserInfoTransferInfo[]` | Pending user info transfers |\n| `outstandingFileTransfers` | `FileTransferInfo[]` | Pending file transfers |\n\n### Methods\n\n#### Lifecycle\n\n- `activate(): Promise\u003cActivationState\u003e` - Activate the WatchConnectivity session\n\n#### Real-time Messaging (requires `isReachable`)\n\n- `sendMessage(message): Promise\u003cRecord\u003cstring, unknown\u003e\u003e` - Send message and get reply\n- `sendMessageData(base64Data): Promise\u003cstring\u003e` - Send raw data and get reply\n- `replyToMessage(replyId, reply): void` - Reply to an incoming message\n- `replyToMessageData(replyId, base64Data): void` - Reply with raw data\n\n#### Background Sync\n\n- `updateApplicationContext(context): Promise\u003cvoid\u003e` - Update application context (latest-wins)\n- `transferUserInfo(userInfo): UserInfoTransferInfo` - Queue user info transfer (FIFO)\n- `transferCurrentComplicationUserInfo(userInfo): UserInfoTransferInfo` - Transfer for complications\n- `transferFile(url, metadata?): FileTransferInfo` - Transfer a file\n\n### Event Listeners\n\nAll listeners return an `EventSubscription` with a `.remove()` method for cleanup.\n\n| Listener | Event Type | Description |\n|----------|------------|-------------|\n| `addSessionStateListener` | `SessionStateChangedEvent` | Session state changes |\n| `addReachabilityListener` | `ReachabilityChangedEvent` | Reachability changes |\n| `addActivationListener` | `ActivationDidCompleteEvent` | Activation completed |\n| `addMessageListener` | `MessageReceivedEvent` | Message received |\n| `addMessageDataListener` | `MessageDataReceivedEvent` | Data message received |\n| `addApplicationContextListener` | `ApplicationContextReceivedEvent` | Context received |\n| `addUserInfoListener` | `UserInfoReceivedEvent` | User info received |\n| `addFileListener` | `FileReceivedEvent` | File received |\n| `addFileTransferProgressListener` | `FileTransferProgressEvent` | Transfer progress |\n| `addFileTransferCompletedListener` | `FileTransferCompletedEvent` | Transfer completed |\n| `addUserInfoTransferCompletedListener` | `UserInfoTransferCompletedEvent` | User info transfer completed |\n\n## Integration with expo-apple-targets\n\nThis module is designed to work seamlessly with [@bacons/expo-apple-targets](https://github.com/EvanBacon/expo-apple-targets) for Apple Watch app development.\n\n### Shared App Groups\n\nTo share data between your main app and Watch app via `UserDefaults`:\n\n**app.json:**\n```json\n{\n  \"expo\": {\n    \"ios\": {\n      \"entitlements\": {\n        \"com.apple.security.application-groups\": [\"group.com.yourapp.shared\"]\n      }\n    }\n  }\n}\n```\n\n**targets/watch/expo-target.config.js:**\n```javascript\nmodule.exports = (config) =\u003e ({\n  type: \"watch\",\n  entitlements: {\n    \"com.apple.security.application-groups\": \n      config.ios.entitlements[\"com.apple.security.application-groups\"],\n  },\n});\n```\n\n## Platform Support\n\n| Platform | Support |\n|----------|---------|\n| iOS | ✅ Full support |\n| Android | ❌ Returns `isSupported: false` |\n| Web | ❌ Not supported |\n\n## License\n\nMIT\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fixacik%2Fexpo-watch-connectivity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fixacik%2Fexpo-watch-connectivity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fixacik%2Fexpo-watch-connectivity/lists"}