Server-Side Communication ActionScript > Stream.send

 

Stream.send

Availability

Flash Communication Server MX.

Usage

Stream.send(handlerName, [p1, ..., pN])

Parameters

handlerName Calls the specified handler in client-side ActionScript code. The handlerName value is the name of a method relative to the subscribing Stream object. For example, if handlerName is doSomething, the doSomething method at the stream level is invoked with all the p1, ..., pN parameters. Unlike the method names in Client.call and NetConnection.call, the handler name can be only one level deep (that is, it cannot be of the form object/method).

Note: Do not use a built-in method name for a handler name. For example, the subscribing stream will be closed if the handler name is close.

p1, ..., pN Parameters of any ActionScript type, including references to other ActionScript objects. These parameters are passed to the specified handler when it is executed on the Flash client.

Returns

A Boolean value of true if the message was sent to the client, false otherwise.

Description

Method; sends a message to all clients subscribing to the stream and the message is processed by the handler specified on the client. Because the server has higher priority than the clients, the server can still send a message on a stream owned by a client. Unlike the Stream.play() method, the server does not need to take ownership of a stream from the client in order to send a message. After send() is called, the client still owns the stream as a publisher.

Example

This example calls the method Test on the client-side Stream object and sends it the string "hello world":

application.streams["foo"].send("Test", "hello world");

The following example is the client-side ActionScript that receives the Stream.send call. The method Test is defined on the Stream object:

tStream.Test = function(str) {
	// insert code to process the str
}