Skip to content

Bhuvneshn/get-me-my-iphone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Remote iPhone Haptics System

This repo contains 3 components:

  1. server/ Node.js WebSocket relay
  2. apps/macos-controller/ SwiftUI macOS controller app
  3. apps/ios-haptics/ SwiftUI iOS receiver app with Core Haptics

Folder Structure

get-me-my-iphone/
  README.md
  server/
    index.js
    package.json
    README.md
  apps/
    macos-controller/
      macos-controller/
        macos_controllerApp.swift
        ContentView.swift
        MacControllerViewModel.swift
        MacWebSocketClient.swift
        HapticCommand.swift
        Resources/
          Info.plist
    ios-haptics/
      ios-haptics/
        ios_hapticsApp.swift
        ContentView.swift
        IOSHapticsViewModel.swift
        IOSWebSocketClient.swift
        HapticsManager.swift
        HapticCommand.swift
        Resources/
          Info.plist

1) Run the WebSocket Relay Server

cd server
npm install
npm start

Server listens on ws://0.0.0.0:8080 by default.

Optional custom port:

PORT=9000 npm start

2) Set up the macOS App in Xcode

  1. Open Xcode and create a new macOS App project (SwiftUI + Swift).
  2. Replace generated Swift source files with files from:
    • apps/macos-controller/macos-controller/
  3. In target settings, set your app entry file to macos_controllerApp.swift.
  4. Ensure Info.plist includes App Transport Security for local ws:// development:
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>
  1. Build and run on macOS.
  2. Enter server URL (ws://<your-mac-lan-ip>:8080) and click Connect.

3) Set up the iOS App in Xcode

  1. Open Xcode and create a new iOS App project (SwiftUI + Swift).
  2. Replace generated Swift source files with files from:
    • apps/ios-haptics/ios-haptics/
  3. In target settings, set your app entry file to ios_hapticsApp.swift.
  4. Add the same ATS exception in iOS Info.plist for local ws:// testing:
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>
  1. Run on a physical iPhone (Core Haptics is not reliable in simulator).
  2. Use the same server URL as macOS app (ws://<your-mac-lan-ip>:8080) and connect.

Message Format

Commands are sent as JSON text over WebSocket:

{ "type": "tap" }
{ "type": "buzz" }
{ "type": "pulse" }
{ "type": "buzz", "intensity": 0.8 }

Extra command used by controller:

{ "type": "pattern_a", "intensity": 0.8 }

Haptic Mapping (iOS)

  • tap: short transient haptic
  • buzz: continuous haptic for ~1 second
  • pulse: 4 short pulses
  • pattern_a: custom mixed pattern

If Core Haptics is unavailable, commands are safely ignored.

Reconnect Behavior

Both Swift apps auto-reconnect using exponential backoff:

  • starts at 1 second
  • doubles up to 10 seconds max

Production Notes

  • For production, use wss:// and remove broad ATS exceptions.
  • Consider adding client IDs / roles if you want server-side filtering.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors