Contents | Index | Previous | Next
TCrossDataListenerJS.Tango_crossReceive() Method
receive message from another session
Synopsis
Tango_crossReceive(sessionName,message)
Arguments
sessionName A String Object - the name of the sender session.
message A String Object - the message body.
Returns
Nothing.
Description
TCrossDataListenerJS.Tango_crossReceive() method is a user defined callback.
It is called by the Tango runtime if TCrossDataListenerJS interface has been
registered for receiving cross-sessional messages with
TAgentJS.addTCrossDataListenerJS() method.
Example
The page below defines Tango_crossReceive() function. It is first determined
which session sent the message. If the message originates from "Chat" session it
is processed, otherwise - ignored. Accepted messages are parsed to find URL
strings. If an URL is found, a new browser window is open and loaded with the
URL. The mechanism can be used to integrate chat and shared web browser tools.
<script language="javascript">
function Tango_crossReceive(sessionName,message)
{
if(sessionName=="Chat")
{
- ar urlFinder=new String("http://");
- ar beg=message.indexOf(urlFinder);
if(beg<0)
return;
- ar end=message.indexOf(" ",beg+urlFinder.length+1);
if(end<0)
end=message.length+1;
window.open(message.substring(beg,end));
}
}
</script>
See Also
TDataListenerJS.Tango_receive() method