Application Programming Interfaces
Native Application Interface
The native application interface is provided through a dynamically loaded library. This library connects to the Leap Motion service and provides tracking data to your application. You can link to the library directly in C++ and Objective-C applications, or through one of the language bindings provided for Java, C#, and Python.
- The Leap Motion service receives data from the Leap Motion Controller over the USB bus. It processes that information and sends it to running Leap-enabled applications. By default, the service only sends tracking data to the foreground application. However, applications can request that they receive data in the background (a request that can be denied by the user).
- The Leap Motion application runs separately from the service and allows the computer user to configure their Leap Motion installation. The Leap Motion application is a Control Panel applet on Windows and a Menu Bar application on Mac OS X.
- The foreground Leap-enabled application receives motion tracking data from the service. A Leap-enabled application can connect to the Leap Motion service using the Leap Motion native library. Your application can link against the Leap Motion native library either directly (C++ and Objective-C) or through one of the available language wrapper libraries (Java, C#, and Python).
- When a Leap-enabled application loses the operating system focus, the Leap Motion service stops sending data to it. Applications intended to work in the background can request permission to receive data even when in the background. When in the background, the configuration settings are determined by the foreground application.
Leap-enabled web applications
- The Leap Motion service provides a WebSocket server listening on http://127.0.0.1:6437.
- The Leap Motion control panel allows end users to enable or disble the WebSocket server.
- The server sends tracking data in the form of JSON messages. An application can send configuration messages back to the server.
This interface is intended primarily for web applications, but any application that can establish a WebSocket connection can use it. The server conforms to RFC6455.