> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainlit.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Window Messaging

# on\_window\_message

Decorator to react to messages coming from the Web App's parent window.
The decorated function is called every time a new window message is received.

## Parameters

<ParamField path="message" type="str">
  The message coming from the Web App's parent window.
</ParamField>

## Usage

```python theme={null}
import chainlit as cl

@cl.on_window_message
def main(message: str):
  # do something
```

# send\_window\_message

Function to send messages to the Web App's parent window.

## Parameters

<ParamField path="message" type="str">
  The message to send to the Web App's parent window.
</ParamField>

## Usage

```python theme={null}
@cl.on_message
async def message():
  await cl.send_window_message("Server: Hello from Chainlit")
```
