# Send a msg from web dev to perspective msg handler and get the response

**URL:** <https://forum.inductiveautomation.com/t/send-a-msg-from-web-dev-to-perspective-msg-handler-and-get-the-response/49664>\
**Category:** Ignition\
**Created:** [August 7, 2021, 7:44am UTC](https://forum.inductiveautomation.com/t/send-a-msg-from-web-dev-to-perspective-msg-handler-and-get-the-response/49664 "2021-08-07T07:44:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [August 7, 2021, 7:44am UTC](https://forum.inductiveautomation.com/t/send-a-msg-from-web-dev-to-perspective-msg-handler-and-get-the-response/49664/1 "2021-08-07T07:44:47Z")

</div>

Hi  
I want to create a simple API with web dev module so each time it receive GET request with below parameters , the endpoint send a message to a specific perspective message hander and receive the status of that component.

Ajax request \<-\> web dev \<-\> perspective event handler

Parameters:  
session ID  
Page ID  
project name  
component name

The problem the system.perspective.sendmessage() which is called from web dev endpoint doesn’t accept response from event handler and I don’t know how to send data back to web dev from event handler.

Thanks for any idea.

---

<div class="post-metadata">

**Author:** ![kyler.kamyszek](https://avatars.discourse-cdn.com/v4/letter/k/a4c791/32.png) [@kyler.kamyszek](https://forum.inductiveautomation.com/u/kyler.kamyszek)\
**Post date:** [August 20, 2021, 12:54pm UTC](https://forum.inductiveautomation.com/t/send-a-msg-from-web-dev-to-perspective-msg-handler-and-get-the-response/49664/2 "2021-08-20T12:54:33Z")

</div>

I don’t believe this is possible. Message Handlers have a scope that only refers to a session of Perspective. If a message is sent outside of a session, like a gateway script or Web Dev, there is no session scope for the message to be handled.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [August 20, 2021, 12:59pm UTC](https://forum.inductiveautomation.com/t/send-a-msg-from-web-dev-to-perspective-msg-handler-and-get-the-response/49664/3 "2021-08-20T12:59:41Z")

</div>

system.net.httpPost maybe has something usefull

---

<div class="post-metadata">

**Author:** ![alan.s.kinnaman](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@alan.s.kinnaman](https://forum.inductiveautomation.com/u/alan.s.kinnaman)\
**Post date:** [December 3, 2021, 10:23pm UTC](https://forum.inductiveautomation.com/t/send-a-msg-from-web-dev-to-perspective-msg-handler-and-get-the-response/49664/4 "2021-12-03T22:23:28Z")

</div>

I think you can call `system.util.sendMessage` from WebDev, then handle that message in Perspective Session Events, then from there, use `system.perspective.sendMessage` to send a message to Perspective sessions.

---

<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:** [December 3, 2021, 10:30pm UTC](https://forum.inductiveautomation.com/t/send-a-msg-from-web-dev-to-perspective-msg-handler-and-get-the-response/49664/5 "2021-12-03T22:30:51Z")

</div>

> [@nader.chinichian](#):
>
> Thanks for any idea.

Try sending a CompletableFuture to Perspective and complete it in your Perspective message handler. Be sure to use a timeout in WebDev to deal with the message falling in the bitbucket on the floor.
