---
id: "T:cAlgo.API.WebViewWebMessageReceivedEventArgs"
kind: "class"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/EventArgs/WebViewWebMessageReceivedEventArgs/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# WebViewWebMessageReceivedEventArgs (class)

Provides data for the WebView control WebMessageReceived event.

Environments: Desktop supported · CLI not supported · Cloud not supported.

- CLI: Never raised in the CLI: the events that pass it never fire there (WebView.WebMessageReceived).
- Cloud: Never raised in the cloud: the events that pass it never fire there (WebView.WebMessageReceived).

## Definition

```csharp
public class WebViewWebMessageReceivedEventArgs
```

## Examples

C#:

```csharp
protected override void OnStart()
{
    var webView = new WebView();
    webView.WebMessageReceived += OnWebMessageReceived;
    Chart.AddControl(webView);
    webView.NavigateToStringAsync("<button onclick=\"window.chrome.webview.postMessage('buy')\">Buy</button>");
}

private void OnWebMessageReceived(WebViewWebMessageReceivedEventArgs args)
{
    Print("Message {0} received from {1}", args.Message, args.Source);
}
```

Python:

```python
def on_start(self):
    webView = WebView()
    webView.WebMessageReceived += self.on_web_message_received
    api.Chart.AddControl(webView)
    webView.NavigateToStringAsync("<button onclick=\"window.chrome.webview.postMessage('buy')\">Buy</button>")

def on_web_message_received(self, args):
    api.Print(f"Message {args.Message} received from {args.Source}")
```

## Properties

- `public string Message {get;}` — The message that was received. [details](https://help.ctrader.com/ctrader-algo/references/EventArgs/WebViewWebMessageReceivedEventArgs/Message/index.md)
- `public string Source {get;}` — Gets the URI of the document that sent this web message. [details](https://help.ctrader.com/ctrader-algo/references/EventArgs/WebViewWebMessageReceivedEventArgs/Source/index.md)
- `public WebView WebView {get;}` — WebView Control. [details](https://help.ctrader.com/ctrader-algo/references/EventArgs/WebViewWebMessageReceivedEventArgs/WebView/index.md)

