# Local Requests

## Overview

<table><thead><tr><th width="271">Purpose</th><th width="188">Message Type</th><th width="138">Icon Glyph</th><th>File Prefix</th></tr></thead><tbody><tr><td>Send message to self</td><td>Asynchronous</td><td><img src="https://2767648102-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZWihGdeYUalj239OUdAB%2Fuploads%2Fi7nZkmLuDkh232rjN0yZ%2Fimage.png?alt=media&#x26;token=dd3ac590-8d1b-466d-a2c7-c95fdc5ecad1" alt="" data-size="line"></td><td>rql_</td></tr></tbody></table>

{% hint style="success" %}
The images below are taken from the [Workers Fundamentals](https://docs.workersforlabview.io/getting-started/example-projects) example project.
{% endhint %}

## Local Request Purpose

A Local Request is a message that a Worker can send to itself. You can use Local Request VIs to send a message from a Worker's EHL to its MHL, or between MHL cases of the same Worker.&#x20;

<figure><img src="https://2767648102-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZWihGdeYUalj239OUdAB%2Fuploads%2FW28CGXoGi6gs0OHS1xRf%2Fimage.png?alt=media&#x26;token=723f91db-615e-4f29-97a3-2a3ddf6b7652" alt="" width="265"><figcaption><p>A local request is a message that a Worker can only send to itself</p></figcaption></figure>

## Local Request usage example

The image below demonstrates the use of a Local Request VI sending a message from the EHL to the MHL of this Worker's QMH, and from the MHL case to another MHL case of the same Worker.

<figure><img src="https://2767648102-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZWihGdeYUalj239OUdAB%2Fuploads%2FSmpP2mYSI3JkUziniWtC%2Fimage.png?alt=media&#x26;token=453c69b2-619b-4400-98df-6a41445ed30d" alt=""><figcaption><p>Worker A : Main.vi - Local Request VI example</p></figcaption></figure>

## Local Request VI

A Local Request VI is required to be wired inline with a Worker's [Main Data Wire](https://docs.workersforlabview.io/fundamental-concepts/important-terms#worker-main-data-wire), and can be used from within a Worker's EHL or MHL. This VI will send a message to the Worker's MHL case that has the same name as the Request VI.

Every Local Request VI filename takes the prefix: **rql\_** (**r**e**q**uest **l**ocal). Every Local Request VI icon contains a blue glyph <img src="https://2767648102-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZWihGdeYUalj239OUdAB%2Fuploads%2Fi7nZkmLuDkh232rjN0yZ%2Fimage.png?alt=media&#x26;token=dd3ac590-8d1b-466d-a2c7-c95fdc5ecad1" alt="" data-size="line">in its bottom-right corner. An example of a Local Request VI is shown below.

<figure><img src="https://2767648102-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZWihGdeYUalj239OUdAB%2Fuploads%2FFnQSiF9UoktKX6xm7VM3%2Fimage.png?alt=media&#x26;token=9519d5db-b04a-4f62-b234-54e9780d2626" alt=""><figcaption><p>Worker A : rql_Send String.vi</p></figcaption></figure>

#### Data in

Data that will be sent along with the message. By default, this is a [typedef ](#local-request-typedef)that has the same filename as the Local Request VI.

#### Message Priority

The [priority](https://docs.workersforlabview.io/fundamental-concepts/priority-queue) of the message (default is Normal) can be set to either Low, Normal or High.

#### Show in Debugger?

When this flag is TRUE, then meta-data about this message will be sent to the [Workers Debug Server](https://docs.workersforlabview.io/workers-tools/workers-tools-menu/workers-debug-server).

## Local Request Typedef

Local Request typedefs are created with the same icon and filename as their matching Local Request VI. Their purpose is to provide a custom container (cluster) for the data that will be sent along with the message to the Local Request's MHL case.

## Local Request MHL Cases

For every Local Request, a MHL case will be created to receive the message sent by the [Local Request VI](#local-request-vi). Local Request MHL cases will automatically be added to the Worker's case structure section called **--- LOCAL API CASES ---**. To convert the data sent with the message to its specific data type, a Variant to Data node is required at the beginning of every Local Request MHL case (this will automatically be added to the MHL case when the MHL case is created by the [Create MHL Case tool](https://docs.workersforlabview.io/workers-tools/quickdrop-shortcuts/create-mhl-case-tool-ctrl+9)).

<figure><img src="https://2767648102-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZWihGdeYUalj239OUdAB%2Fuploads%2Fyo9OoY11POVNjdHmY5eu%2Fimage.png?alt=media&#x26;token=9847f3a5-5b01-4aaf-951b-8f40f647356e" alt=""><figcaption><p>Worker A : Main.vi - Local Request MHL cases</p></figcaption></figure>

## Local Request Folders

Local Request VIs created by the [Create MHL Case tool](https://docs.workersforlabview.io/workers-tools/quickdrop-shortcuts/create-mhl-case-tool-ctrl+9) are added to a Worker's *Local API >> Requests* folder. Their scope is set to *protected* because they are designed to be used only from within the Worker that owns them.

<figure><img src="https://2767648102-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZWihGdeYUalj239OUdAB%2Fuploads%2FRaN6epSSRNX8fwUFmuD0%2Fimage.png?alt=media&#x26;token=eece9adb-6451-43b4-ad23-3827fd2f6e87" alt="" width="563"><figcaption><p> Local Request folder structure within a Worker</p></figcaption></figure>
