Send message from alarm pipelines script to perspective session

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?

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.

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

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.

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

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

1 Like

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

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.

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.

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.

Hi Paul,

Here is my top header dock which I put hidden iFrame component with following binding as describe above in this thread. (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.

1 Like

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.

1 Like

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