Server-Side Communication ActionScript > NetConnection.addHeader

 

NetConnection.addHeader

Availability

Flash Communication Server MX.

Usage

myNetConn.addHeader(name, mustUnderstand, object)

Parameters

name A string that identifies the header and the ActionScript object data associated with it.

mustUnderstand A Boolean value; true indicates that the server must understand and process this header before it handles any of the following headers or messages.

object Any ActionScript object.

Returns

Nothing.

Description

Method; adds a context header to the AMF packet structure. This header is sent with every future AMF packet. If you call NetConnection.addHeader using the same name, the new header replaces the existing header, and the new header persists for the duration of the NetConnection object. You can remove a header by calling NetConnection.addHeader with the name of the header to remove and an undefined object.

Example

The following example creates a new NetConnection instance, nc, and connects to an application at web server www.foo.com that is listening at port 1929. This application dispatches the service /blag/SomeCoolService. The last line of code adds a header called foo:

nc=new NetConnection();
nc.connect("http://www.foo.com:1929/blag/SomeCoolService");
nc.addHeader("foo", true, new Foo());