WebSocket server for integrating Tobii Pro eye trackers with jsPsych
Project description
jspsych-tobii (Python Server)
WebSocket server for integrating Tobii eye trackers with jsPsych experiments.
Installation
# Install with Tobii SDK support
pip install jspsych-tobii[tobii]
# Or install SDK separately
pip install jspsych-tobii
pip install tobii-research
For Testing Without Hardware
# Use built-in mock tracker
pip install jspsych-tobii
jspsych-tobii-server --mock
Supported Hardware
All trackers are supported via the tobii-research package:
- Modern Pro series (via
tobii-research2.x): Spectrum, Fusion, Nano, Spark - Older models (via
tobii-research1.x): X3-120, TX300, X2-60, T120, etc. - Mock Tracker: For testing and development without hardware
Note: If you have an older tracker like the X3-120, install
tobii-research<2(version 1.x supports these models; version 2.x dropped them).
See ADAPTER_GUIDE.md for detailed SDK information.
Quick Start
Start Server
# Basic usage (auto-detect tracker, port 8080)
jspsych-tobii-server
# Specify port
jspsych-tobii-server --port 9000
# Enable debug logging
jspsych-tobii-server --log-level DEBUG
# Log to file
jspsych-tobii-server --log-file server.log
Use with jsPsych
See the main README for JavaScript integration examples.
Command-Line Options
jspsych-tobii-server [OPTIONS]
Options:
--host HOST Server host address (default: localhost)
--port PORT Server port (default: 8080)
--tracker ADDRESS Specific tracker address (auto-detect if not specified)
--buffer-size SIZE Maximum buffer size (default: 10000)
--log-level LEVEL Logging level: DEBUG, INFO, WARNING, ERROR (default: INFO)
--log-file FILE Log file path (console if not specified)
--version Show version and exit
--help Show this help message
Python API
You can also use the server programmatically:
from jspsych_tobii import TobiiServer, ServerConfig
import asyncio
# Create configuration
config = ServerConfig(
host='localhost',
port=8080,
log_level='INFO'
)
# Create and start server
server = TobiiServer(config)
asyncio.run(server.start())
Features
- Auto-detection: Automatically finds connected Tobii eye trackers
- WebSocket Protocol: Real-time bidirectional communication
- Time Synchronization: Accurate timestamp alignment between client and server
- Calibration Support: Full calibration and validation workflow
- Data Buffering: Efficient data storage and retrieval
- Logging: Comprehensive logging for debugging
WebSocket Protocol
The server communicates via WebSocket using JSON messages.
Message Types
Client -> Server:
start_tracking: Start eye tracking data collectionstop_tracking: Stop eye trackingcalibration_start: Begin calibrationcalibration_point: Collect calibration pointcalibration_compute: Compute calibrationvalidation_start: Begin validationvalidation_point: Collect validation pointvalidation_compute: Compute validationget_current_gaze: Get latest gaze positionget_data: Get gaze data for time rangetime_sync: Synchronize time
Server -> Client:
gaze_data: Real-time gaze data stream- Response messages for each request type
Troubleshooting
Tracker Not Found
- Ensure tracker is connected (USB or network)
- Check that Tobii Eye Tracker Manager software recognizes the tracker
- Verify that no other applications are using the tracker
- Try specifying tracker address explicitly:
jspsych-tobii-server --tracker tet-tcp://192.168.1.100
Connection Issues
- Check firewall settings
- Verify port is not in use
- Try a different port:
jspsych-tobii-server --port 9000
Performance Issues
- Increase buffer size:
jspsych-tobii-server --buffer-size 20000
Development
Install Development Dependencies
pip install -e ".[dev]"
Run Tests
pytest
Code Formatting
black jspsych_tobii
ruff check jspsych_tobii
License
MIT
Support
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jspsych_tobii-0.1.0.tar.gz.
File metadata
- Download URL: jspsych_tobii-0.1.0.tar.gz
- Upload date:
- Size: 19.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb7522a5828d64de3e0838f52a385af0a72208935abfeefd16fc88839515cdca
|
|
| MD5 |
8e1f6210b1b77d8237db0f35adedd3e4
|
|
| BLAKE2b-256 |
1db3db2c6ed15a4ee12c41a8a9afcd90421124f6d39f5b134308bc760c616fae
|
Provenance
The following attestation bundles were made for jspsych_tobii-0.1.0.tar.gz:
Publisher:
release-python.yml on jspsych/tobii-integration
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jspsych_tobii-0.1.0.tar.gz -
Subject digest:
eb7522a5828d64de3e0838f52a385af0a72208935abfeefd16fc88839515cdca - Sigstore transparency entry: 924443355
- Sigstore integration time:
-
Permalink:
jspsych/tobii-integration@f9c14a0548bfd764283bf967577790f439be635b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jspsych
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@f9c14a0548bfd764283bf967577790f439be635b -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file jspsych_tobii-0.1.0-py3-none-any.whl.
File metadata
- Download URL: jspsych_tobii-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fdd0c8f3b293e4033924a6cc0adaaf46aa1916512fc4b0b0395dad233b25be6f
|
|
| MD5 |
13cd292439446fd5f4cf346483658eca
|
|
| BLAKE2b-256 |
8d61014e973b710fb8310c1cc7bb7d2b6e69a9ba4740375eb62f325c83bc9e82
|
Provenance
The following attestation bundles were made for jspsych_tobii-0.1.0-py3-none-any.whl:
Publisher:
release-python.yml on jspsych/tobii-integration
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jspsych_tobii-0.1.0-py3-none-any.whl -
Subject digest:
fdd0c8f3b293e4033924a6cc0adaaf46aa1916512fc4b0b0395dad233b25be6f - Sigstore transparency entry: 924443362
- Sigstore integration time:
-
Permalink:
jspsych/tobii-integration@f9c14a0548bfd764283bf967577790f439be635b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jspsych
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@f9c14a0548bfd764283bf967577790f439be635b -
Trigger Event:
workflow_dispatch
-
Statement type: