Realtime.co

try it for free! No installation required

Check our Realtime® Demos

A sample of the Realtime® Framework potential.

All our demos were created by using xRTML, our cutting edge API that allow developers to build their Realtime®-enabled web applications very fast and easily.

Broadcast

<XRTML:Broadcast .../>

← back

This demo is actually 2 demos in one. It is the same as the Execute demo that is also available here. The broadcast demo allows you to send messages freely to any given channel. You may see it as a "lower level" kind of tag, where you actually build your own messages to send them to the Realtime® servers. Along with the Execute tag, it provides you with the tools to make virtually anything you wish. Since you can attach it to object events, it's a very powerful tool on your xRTML arsenal!

xRTML.ready(function(){
    xRTML.TagManager.create({
        name: "Broadcast",
        connections:["myConnection"],
        triggers:[{
            name: "myTrigger"
        }],
        dispatchers:[{
            xrtmlmessage: '{"xrtml":{"trigger":"myTrigger", "action":"", "data":{"msg": "Random Message" }}}'
        }]
    });
});
<xrtml:Broadcast version="3.0">
    <xrtml:connections>
        <xrtml:connection name="myConnection"></xrtml:connection>
    </xrtml:connections>
    <xrtml:triggers>
        <xrtml:trigger name="myTrigger"></xrtml:trigger>
    </xrtml:triggers>
    <xrtml:dispatchers>
        <xrtml:dispatcher xrtmlmessage='{"xrtml":{"trigger":"myTrigger", "action":"", "data":{"msg": "Random Message" }}}'></xrtml:dispatcher>
    </xrtml:dispatchers>
</xrtml:Broadcast>