> For the complete documentation index, see [llms.txt](https://help.imotions.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.imotions.com/lab/sensor-setup/api/event-forwarding-api-example-streaming-to-external-software.md).

# Event Forwarding API example (streaming to external software)

Use PuTTY to check that the iMotions Event Forwarding API streams data, on the same computer or from another computer on the network.

PuTTY is a free terminal program that can show the messages that the iMotions Event Forwarding API sends, exactly as your own software would receive them. This article explains how to use PuTTY to check that forwarding works before you write or connect your own software.

For the settings and message formats of the Event Forwarding API, see [iMotions Lab API](https://help.imotions.com/lab/sensor-setup/api/imotions-lab-api.md).

## Viewing forwarded events in PuTTY

PuTTY connects to iMotions over TCP, so Event Forwarding must use TCP.

1. In iMotions, open the **API** tab of Global Settings, select **Enable forwarding** and **Use TCP**, and note the **Port** (default 8088).
2. Download and install [PuTTY](https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html).
3. Open PuTTY and enter the connection details:

   * **Host Name (or IP address)**: `localhost` if PuTTY runs on the iMotions computer, or the name or IP address of the iMotions computer if it runs on another computer. See [Same computer or another computer](#same-computer-or-another-computer).
   * **Port**: the port from the iMotions API settings.
   * **Connection type**: **Raw**.

   ![PuTTY Configuration with Host Name localhost, Port 8088 and Connection type Raw](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-8a2a0cc1554fe563b6ff7fe14c72bede82f85421%2Fb8c646408c_ben1i3fnx0ofwqjou3tamg.webp?alt=media)
4. Click **Open**. PuTTY shows the events from iMotions as they occur.

Which events are forwarded depends on the API settings and on the sensors in the study. Events from iMotions itself, such as the start and end of an eye tracker calibration, look like this:

![PuTTY showing GazeCalibrationStart and GazeCalibrationEnd events from iMotions](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-93532d85b6eaba4ab5741b16d227f7d5c1eee92f%2F5e1e51ac7e_8ovmowoz70mxcvh3sugjg.webp?alt=media)

Sensor data, here from an eye tracker, arrives as a continuous stream of `EyeData` events:

![PuTTY showing a stream of EyeTracker EyeData events](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-413b759f558c098cef2ff12ffe7638ba57518e4c%2Fe7fbdc4269_g76mqeg6nu68i6ervlbwww.webp?alt=media)

## Same computer or another computer

The software that receives the events can run on the iMotions computer or on another computer on the network.

| Setup            | Host name in the receiving software             | What can block the connection                                                                                                                                                                             |
| ---------------- | ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Same computer    | `localhost` or `127.0.0.1`                      | Rarely anything. Connections within the same computer are normally not blocked by Windows Defender Firewall, but some security software also checks them.                                                 |
| Another computer | The name or IP address of the iMotions computer | The firewall on the iMotions computer must allow incoming connections to iMotions on the forwarding port. The network itself, for example a company or university network, can also block the connection. |

With UDP instead of TCP, the direction is reversed: iMotions sends the events to the **Hostname** and **Port** in its API settings, and the firewall on the receiving computer must allow incoming UDP traffic on that port.

## Troubleshooting

If no events appear, the connection is most likely blocked by a firewall or other security software. On Windows 11:

* Check that Windows Defender Firewall allows iMotions (`AttentionTool.exe`) to accept incoming connections. You can check this under **Windows Security** > **Firewall & network protection** > **Allow an app through firewall**.
* Check that the rule applies to the network profile the computer uses (**Domain**, **Private** or **Public**). A computer on an unknown network is often set to **Public**, where more connections are blocked.
* Check other security software on the computer, such as antivirus or company endpoint protection, which may have its own firewall.
* If PuTTY runs on another computer, check its firewall as well, and ask your IT department whether the network allows connections between the two computers on the port.

## MATLAB examples

These MATLAB scripts show how to receive forwarded events and how to send events to iMotions:

{% file src="/files/HbSbhGJlaUOGw36jhSiQ" %}
iMT\_EventForwardingAPI.m (MATLAB)
{% endfile %}

{% file src="/files/02T9Hth88zqV5PBPHEU4" %}
iMT\_EventReceivingAPI.m (MATLAB)
{% endfile %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.imotions.com/lab/sensor-setup/api/event-forwarding-api-example-streaming-to-external-software.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
