Created on 24 June 2021
icon_unfollowing
Login to follow
web-api-broadcast-channel

Web API Broadcast Channel

Stable version 0.3.0 (Compatible with OutSystems 11)
Uploaded on 24 June 2021 by 
web-api-broadcast-channel

Web API Broadcast Channel

Documentation
0.3.0

Intro


The Broadcast Channel API allows basic communication between browsing contexts (that is, windows, tabs, frames, or iframes) and workers on the same origin.

By creating a BroadcastChannel object, you can receive any messages that are posted to it. You don't have to maintain a reference to the frames or workers you wish to communicate with: they can “subscribe” to a particular channel by constructing their own BroadcastChannel with the same name, and have bi-directional communication between all of them.  


Implementation


This library implements:

  • Blocks
    • BroadcastChannel
      • ChannelName
      • OnMessage
      • OnMessageError
  • Methods
    • BroadcastChannel_PostMessage
      • WidgetID
      • Message
    • BroadcastChannel_Properties
      • WidgetID
      • ChannelName (Out)


Usage


The BroadcastChannel block represents a named channel that any browsing context of a given origin can subscribe to. It allows communication between different documents (in different windows, tabs, frames or iframes) of the same origin. Messages are broadcasted via a message event fired at all BroadcastChannel objects listening to the channel.

Implement the OnMessage to handle incoming messages

Use the BroadcastChannel_PostMessage method to send a message to a channel.

The WidgetID is the name of the block, and is mandatory input for the post message method.


Use cases


Some use cases for broadcast channels include:

  • Detect user actions in other tabs
  • Know when a user logs into an account in another window/tab.
  • When the user uploads a photo in one window, pass it around to other open pages pop ups.


Check out the demo app of an online store where if you add a product to the cart all open tabs will update the cart automatically.

Even Amazon cant do this ;)




Support options
This asset is not supported by OutSystems. You may use the discussion forums to leave suggestions or obtain best-effort support from the community, including from  who created this asset.
Dependencies
Web API Broadcast Channel has no dependencies.