# Client Event Script Message Handler

**URL:** <https://forum.inductiveautomation.com/t/client-event-script-message-handler/24206>\
**Category:** Ignition\
**Tags:** ignition79, scripting\
**Created:** [April 17, 2019, 3:34pm UTC](https://forum.inductiveautomation.com/t/client-event-script-message-handler/24206 "2019-04-17T15:34:42Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![closset.gauthier](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@closset.gauthier](https://forum.inductiveautomation.com/u/closset.gauthier)\
**Post date:** [April 17, 2019, 3:34pm UTC](https://forum.inductiveautomation.com/t/client-event-script-message-handler/24206/1 "2019-04-17T15:34:42Z")

</div>

Hi everyone,

I would like to use the system.util.sendRequest function in a global script to call a message Handler defined in the Client Event Script Message part. Do you know how to do it? Every time i try to do it i have the following error :

The message handler “test” could not be found!

But here is what i get :

 ![client%20event%20script%20message](https://us1.discourse-cdn.com/inductiveautomation/original/2X/4/439b03d850569e1cf90b8c123e2ce098af64bc42.png)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 17, 2019, 3:55pm UTC](https://forum.inductiveautomation.com/t/client-event-script-message-handler/24206/2 "2019-04-17T15:55:27Z")

</div>

That is a client message handler. Are you specifying a project and scope of ‘C’ in your `system.util.sendRequest` call? Post your code to send the request here, if possible. If you aren’t specifying the scope argument, your outbound request is trying to find a gateway-scoped message handler - check the ‘Gateway Event Scripts’ section.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 17, 2019, 4:44pm UTC](https://forum.inductiveautomation.com/t/client-event-script-message-handler/24206/3 "2019-04-17T16:44:01Z")

</div>

Huh. I thought `sendRequest()` could only be used in the client/designer to query the gateway.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 17, 2019, 5:06pm UTC](https://forum.inductiveautomation.com/t/client-event-script-message-handler/24206/4 "2019-04-17T17:06:30Z")

</div>

Oh, yeah, you’re probably right - so there’s not a scope argument missing, you’re just defining the message handler in the wrong place - it needs to be a ‘gateway message handler’, not a ‘client message handler’.

---

<div class="post-metadata">

**Author:** ![closset.gauthier](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@closset.gauthier](https://forum.inductiveautomation.com/u/closset.gauthier)\
**Post date:** [April 18, 2019, 9:12am UTC](https://forum.inductiveautomation.com/t/client-event-script-message-handler/24206/5 "2019-04-18T09:12:05Z")

</div>

What a i need to do is to use Client Event Script Message to get the connection mode of all clients connected to the gateway. These Client Message Handlers should be abble to send me this kind of information no?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 18, 2019, 11:41am UTC](https://forum.inductiveautomation.com/t/client-event-script-message-handler/24206/6 "2019-04-18T11:41:13Z")

</div>

Yes, you can use sendMessage in the gateway with scope ‘C’ to invoke message handlers in the clients, separately for every possible project. Those client message handlers will have to also use sendMessage with scope ‘G’ to return the information collected. sendRequest can’t do this.

---

<div class="post-metadata">

**Author:** ![closset.gauthier](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@closset.gauthier](https://forum.inductiveautomation.com/u/closset.gauthier)\
**Post date:** [April 18, 2019, 1:05pm UTC](https://forum.inductiveautomation.com/t/client-event-script-message-handler/24206/7 "2019-04-18T13:05:49Z")

</div>

I will try this. Good to know ! I’ll come back to you after testing this 😉

---

<div class="post-metadata">

**Author:** ![martinel3746](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@martinel3746](https://forum.inductiveautomation.com/u/martinel3746)\
**Post date:** [April 18, 2019, 2:53pm UTC](https://forum.inductiveautomation.com/t/client-event-script-message-handler/24206/8 "2019-04-18T14:53:57Z")

</div>

It’s not an elegant solution but I have a message handler that after doing it’s work, sends a message of it’s own. It’s not a response but shortly after sending a message, a message is received.

---

<div class="post-metadata">

**Author:** ![Nikhil.Sawalakhe](https://avatars.discourse-cdn.com/v4/letter/n/cc9497/32.png) [@Nikhil.Sawalakhe](https://forum.inductiveautomation.com/u/Nikhil.Sawalakhe)\
**Post date:** [July 22, 2019, 11:21am UTC](https://forum.inductiveautomation.com/t/client-event-script-message-handler/24206/9 "2019-07-22T11:21:29Z")

</div>

SendRequest() function is used for Gateway to Gateway Communication and it expect response to the message.
