# Send message from alarm pipelines script to perspective session

**URL:** <https://forum.inductiveautomation.com/t/send-message-from-alarm-pipelines-script-to-perspective-session/31400>\
**Category:** Ignition Early Access\
**Created:** [January 20, 2020, 6:34am UTC](https://forum.inductiveautomation.com/t/send-message-from-alarm-pipelines-script-to-perspective-session/31400 "2020-01-20T06:34:32Z")\
**Posts on this page:** 12\
**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:** [January 20, 2020, 6:34am UTC](https://forum.inductiveautomation.com/t/send-message-from-alarm-pipelines-script-to-perspective-session/31400/1 "2020-01-20T06:34:32Z")

</div>

Hello  
I’d like to send a message from alarm pipeline script block to all active session.  
For each alarm I want to send the description of tag (converted to speech wav file) as a message and in perspective message handler use system.util.playSound() to play it for user.

As I read document it seems gateway scope system.util.send message() can’t send message to perspective session.  
And system.perspective.sendMessage() doesn’t work in gateway scripting scope. So what is the workaround for this?

---

<div class="post-metadata">

**Author:** ![osolorzano](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/osolorzano/32/6432_2.png) [@osolorzano](https://forum.inductiveautomation.com/u/osolorzano)\
**Post date:** [January 21, 2020, 6:39pm UTC](https://forum.inductiveautomation.com/t/send-message-from-alarm-pipelines-script-to-perspective-session/31400/2 "2020-01-21T18:39:09Z")

</div>

`system.util.playSoundClip()` won’t work in this situation because that function will run on the gateway, so the gateway will play the sound not the actual sessions.  
As for the second part of your question, `system.util.sendMessage()` is getting updated as part of 8.0.8 and will allow you to specify “S” for session scope.

---

<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:** [January 22, 2020, 12:53pm UTC](https://forum.inductiveautomation.com/t/send-message-from-alarm-pipelines-script-to-perspective-session/31400/3 "2020-01-22T12:53:01Z")

</div>

Hi  
but I easily use system.util.playSoundClip() in onclick event of a button on perspective session and browser play it.

---

<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:** [January 22, 2020, 4:58pm UTC](https://forum.inductiveautomation.com/t/send-message-from-alarm-pipelines-script-to-perspective-session/31400/4 "2020-01-22T16:58:44Z")

</div>

Nope, the gateway is. It’ll happen to work if you’re on the same machine, because, for bizarre legacy reasons, we both allow `system.util.playSoundClip` to work on the gateway, and Windows allows background services to play sounds, but it’s 100% coming from the gateway. Open your project on your phone or another devicce, and your gateway machine will emit the sound when you click it.

---

<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:** [January 23, 2020, 1:48pm UTC](https://forum.inductiveautomation.com/t/send-message-from-alarm-pipelines-script-to-perspective-session/31400/5 "2020-01-23T13:48:57Z")

</div>

Oh I got it now. So what is your suggestion for playing sound on devices?

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [January 23, 2020, 3:11pm UTC](https://forum.inductiveautomation.com/t/send-message-from-alarm-pipelines-script-to-perspective-session/31400/6 "2020-01-23T15:11:40Z")

</div>

I think I had created a ticket to add a perspective function to play sound.

---

<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:** [January 23, 2020, 4:19pm UTC](https://forum.inductiveautomation.com/t/send-message-from-alarm-pipelines-script-to-perspective-session/31400/7 "2020-01-23T16:19:55Z")

</div>

Currently, the only means to do so is the iframe "hack" described in this thread:

> [@\[feature-12986, 15300\]Unacknowledged Alarm Sound](http://forum.inductiveautomation.com/t/feature-12986-15300-unacknowledged-alarm-sound/25460/3):
>
> Use an invisible IFrame, and bind src to (don’t take this literally wink ): if(something = 1, 'http://path/to/some/noise.mp3', '' )

Jae's correct, there's an active feature ticket to add the ability to play sounds from the actual Perspective session directly, but there's some technical hurdles we have to iron out.

---

<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:** [April 3, 2020, 7:03pm UTC](https://forum.inductiveautomation.com/t/send-message-from-alarm-pipelines-script-to-perspective-session/31400/8 "2020-04-03T19:03:10Z")

</div>

Hi Paul  
I try to play alert sound the calling iframe sec link to a mp3 file and it works fine until I discover if I let broswer open for while each time iframe play sound it increase the RAM usage until the session crash in broswer.  
Could you confirm this is a bug and will be fixed or this a iframe normal behavior.

---

<div class="post-metadata">

**Author:** ![PerryAJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/perryaj/32/3281_2.png) [@PerryAJ](https://forum.inductiveautomation.com/u/PerryAJ)\
**Post date:** [April 3, 2020, 7:39pm UTC](https://forum.inductiveautomation.com/t/send-message-from-alarm-pipelines-script-to-perspective-session/31400/9 "2020-04-03T19:39:04Z")

</div>

We’ll need more info/replication to be able to tell you if there’s a ticket for an existing bug. We don’t currently have any specific known leaks that are being tracked.

Can you put together a simple/minimal reproduction project that reproduces the leak? If so, good chance we can investigate and implement a fix.

---

<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:** [April 4, 2020, 3:04am UTC](https://forum.inductiveautomation.com/t/send-message-from-alarm-pipelines-script-to-perspective-session/31400/10 "2020-04-04T03:04:57Z")

</div>

Hi Paul,

Here is my top header dock which I put hidden iFrame component with following binding as describe above in this thread.  
[TOTAL\_2020-04-04\_0719.zip](https://us1.discourse-cdn.com/inductiveautomation/original/2X/6/65495b494d23409771c23ee3cfc67dbda439bcd9.zip) (3.4 KB)

It play a 1sec mp3 clip each 4sec. It took about 10 hour to use all my RAM.  
I use v8.0.6.

 ![play%20sound](https://us1.discourse-cdn.com/inductiveautomation/original/2X/0/0868c7808cb3ffdd790fa84db6c9b22e72b6ad3d.png)

---

<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:** [April 16, 2020, 5:49am UTC](https://forum.inductiveautomation.com/t/send-message-from-alarm-pipelines-script-to-perspective-session/31400/11 "2020-04-16T05:49:14Z")

</div>

Hi Perry  
I find the the culprit of memory leakage. It is for IDM CC extension of chrome. even I disable mp3 file extension in IDM, it cause memory leakage.  
So there is nothing relate to perspective.

---

<div class="post-metadata">

**Author:** ![PerryAJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/perryaj/32/3281_2.png) [@PerryAJ](https://forum.inductiveautomation.com/u/PerryAJ)\
**Post date:** [April 16, 2020, 3:00pm UTC](https://forum.inductiveautomation.com/t/send-message-from-alarm-pipelines-script-to-perspective-session/31400/12 "2020-04-16T15:00:17Z")

</div>

Thanks for the followup Nader, glad to hear you found the culprit!
