Lifecycle of a Streaming Application
Your application communicates with Amazon AppStream and clients through the libraries of the Amazon AppStream SDK.
The lifecycle of an application is as follows:
XStxServerLibraryobject. This ensures that the loaded libraries match the version your application was compiled with. It also gives you a handle to an
XStxServerLibraryobject, which is required for the next step.
XStxServerManagerobject. This object communicates with Amazon AppStream to manage the assignment of client sessions to your application.
XStxIServerManagerListenerevent sink. Pass the location of a callback function to receive events from the
XStxServerManagerobject. Your application calls
XStxServerManagerStartto cause the
XStxServerManagerobject to start accepting client sessions from Amazon AppStream.
Wait for the
XStxServerManagerobject to end the session. During this phase, your application receives events to its
XStxIServerManagerListenercallback function when the session manager accepts a new client session, prompts your application to persist state before a session ends, or terminates a client session.
If the event is
XStxIServerManagerListenerFcnServerInitialize, a new client session has begun, and your application is passed a handle to the
XStxServerobject it will use to stream content to the client. In this case, perform the following steps:
Register event sinks for
XStxIVideoSourceevents. These callback functions are how your application is notified about streaming events.
Call methods of the
XStxServerobject to send audio and video frames. Repeat this step for the duration of the streaming session.
XStxServerobject. When the client is disconnected or the application ends the client session, your application should call
XStxServerTerminateto release resources allocated to the
XStxServerManagerobjects. After the client session ends, release the resources allocated to the