# Clarification about what a native application is in runtime.sendNativeMessage

**URL:** <https://discourse.mozilla.org/t/clarification-about-what-a-native-application-is-in-runtime-sendnativemessage/35123>\
**Category:** Development\
**Created:** [January 15, 2019, 1:12pm UTC](https://discourse.mozilla.org/t/clarification-about-what-a-native-application-is-in-runtime-sendnativemessage/35123 "2019-01-15T13:12:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![diracsbracket](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@diracsbracket](https://discourse.mozilla.org/u/diracsbracket)\
**Post date:** [January 15, 2019, 1:12pm UTC](https://discourse.mozilla.org/t/clarification-about-what-a-native-application-is-in-runtime-sendnativemessage/35123/1 "2019-01-15T13:12:24Z")

</div>

Hi,  
The documentation of [runtime.sendNativeMessage()](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/sendNativeMessage) states

```auto
Sends a single message from an extension to a native application.

```

Does that mean that I can e.g. send a message to a Qt application ? If so, how is the message to be handled in such a “native application” ?

Thanks for clarifying this!

---

<div class="post-metadata">

**Author:** ![freaktechnik](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/freaktechnik/32/37766_2.png) [@freaktechnik](https://discourse.mozilla.org/u/freaktechnik)\
**Post date:** [January 15, 2019, 2:30pm UTC](https://discourse.mozilla.org/t/clarification-about-what-a-native-application-is-in-runtime-sendnativemessage/35123/2 "2019-01-15T14:30:50Z")

</div>

The “further info” article linked provides details on the protocol: [https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native\_messaging#Exchanging\_messages](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging#Exchanging_messages)

---

<div class="post-metadata">

**Author:** ![diracsbracket](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@diracsbracket](https://discourse.mozilla.org/u/diracsbracket)\
**Post date:** [January 16, 2019, 12:23am UTC](https://discourse.mozilla.org/t/clarification-about-what-a-native-application-is-in-runtime-sendnativemessage/35123/3 "2019-01-16T00:23:24Z")

</div>

Thanks for the link!  
I read that before, but was hoping there would maybe be another way to exchange  
info between the background script and the Qt application than using `stdin` and `stdout`.

I think I will try by writing a cookie file with the info, and then let my Qt app react to changes to that file (modification time) to read the info.

If you know of a smarter way, please let me know^^

---

<div class="post-metadata">

**Author:** ![freaktechnik](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/freaktechnik/32/37766_2.png) [@freaktechnik](https://discourse.mozilla.org/u/freaktechnik)\
**Post date:** [January 16, 2019, 8:17am UTC](https://discourse.mozilla.org/t/clarification-about-what-a-native-application-is-in-runtime-sendnativemessage/35123/4 "2019-01-16T08:17:50Z")

</div>

You can alternatively also use a WebSocket, for example. However establishing authenticity is more complicated in that case.

---

<div class="post-metadata">

**Author:** ![diracsbracket](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@diracsbracket](https://discourse.mozilla.org/u/diracsbracket)\
**Post date:** [January 17, 2019, 4:47am UTC](https://discourse.mozilla.org/t/clarification-about-what-a-native-application-is-in-runtime-sendnativemessage/35123/5 "2019-01-17T04:47:59Z")

</div>

Hi Martin,  
You’re absolutely right. I just tested the `WebSocket` method and it is of course much better than what I initially was trying to do.  
Thank you again!
