Skip to content

PushTarget Component

Lance edited this page Jan 11, 2014 · 12 revisions

The pushTarget component must be nested inside a container component. Multiple pushTargets can be nested inside a single container. Each pushTarget represents a single clientside element and can subscribe to multiple topics.

When a message is broadcast, the pushTarget will fire an event which will usually return a block. The resultant markup will update the clientside element. Updates can append or prepend to the current contents of the client element or can replace the content entirely.

Messages are broadcast to pushTargets via the AtmosphereBroadcaster

Parameters

Name Type Default Required Comments
topics List<String> true One or more topics to subscribe to
update UpdateStrategy replace true append, prepend or replace
event String true Serverside event to fire each time a message is broadcast on one of the topics
element String div false Clientside HTML element
clientId String prop:componentResources.id false Clientside element id

Example

<div
   xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
   xmlns:p="tapestry:parameter"
   xmlns:atmos="tapestry-library:atmos"
>
   <atmos:container transport="websocket" fallbackTransport="long-polling">
      <atmos:pushTarget topics="topic1" event="topic1Message" update="replace" element="span">
         Initial content goes here
      </atmos:pushTarget>
      <atmos:pushTarget topics="prop:['topic2','topic3']" event="topic23Message" update="append" />
   </atmos:container>
</div>
Clone this wiki locally