Skip to main content

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-research 2.x): Spectrum, Fusion, Nano, Spark
  • Older models (via tobii-research 1.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 collection
  • stop_tracking: Stop eye tracking
  • calibration_start: Begin calibration
  • calibration_point: Collect calibration point
  • calibration_compute: Compute calibration
  • validation_start: Begin validation
  • validation_point: Collect validation point
  • validation_compute: Compute validation
  • get_current_gaze: Get latest gaze position
  • get_data: Get gaze data for time range
  • time_sync: Synchronize time

Server -> Client:

  • gaze_data: Real-time gaze data stream
  • Response messages for each request type

Troubleshooting

Tracker Not Found

  1. Ensure tracker is connected (USB or network)
  2. Check that Tobii Eye Tracker Manager software recognizes the tracker
  3. Verify that no other applications are using the tracker
  4. Try specifying tracker address explicitly:
    jspsych-tobii-server --tracker tet-tcp://192.168.1.100
    

Connection Issues

  1. Check firewall settings
  2. Verify port is not in use
  3. Try a different port:
    jspsych-tobii-server --port 9000
    

Performance Issues

  1. 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

Metadata

Release files for jspsych-tobii 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jspsych-tobii 0.1.0
File Size Uploaded Provenance Actions
jspsych_tobii-0.1.0.tar.gz 19.9 kB With provenance Details for jspsych_tobii-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jspsych-tobii 0.1.0
File Interpreter ABI Platform Actions
jspsych_tobii-0.1.0-py3-none-any.whl Python 3 none any Details for jspsych_tobii-0.1.0-py3-none-any.whl

Total release size: 38.7 kB

Release files / jspsych_tobii-0.1.0.tar.gz

Download URL jspsych_tobii-0.1.0.tar.gz
Size 19.9 kB
Tags Source
SHA-256 checksum
How to use checksums
eb7522a5828d64de3e0838f52a385af0a72208935abfeefd16fc88839515cdca
BLAKE2b-256 checksum
How to use checksums
1db3db2c6ed15a4ee12c41a8a9afcd90421124f6d39f5b134308bc760c616fae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 6, 2026.

Transparency log

Release files / jspsych_tobii-0.1.0-py3-none-any.whl

Download URL jspsych_tobii-0.1.0-py3-none-any.whl
Size 18.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fdd0c8f3b293e4033924a6cc0adaaf46aa1916512fc4b0b0395dad233b25be6f
BLAKE2b-256 checksum
How to use checksums
8d61014e973b710fb8310c1cc7bb7d2b6e69a9ba4740375eb62f325c83bc9e82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 6, 2026.

Transparency log

Security for jspsych-tobii 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for jspsych_tobii-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page