ServerSession
-
class
cee.vs.ServerSession() A ServerSession object is the first object that needs to be initialized when working with the
StreamModel. It manages the communication with the Visualization Streamer (VizStreamer) service.The
getAvailableStreams_asyncmethod is used to get the information about all available streams. These streams can be subsequently used to createStreamModelinstance(s) with the methodcreateStreamModel.- Example:
- Create a ServerSession and a StreamModel from the first available stream.
// Connect to the server session at the given url. const serverSession = await cee.vs.ServerSession.createInstance_async("http://localhost:8091"); // Get the available streams const streams = await serverSession.getAvailableStreams_async(); if (streams[0]) { const streamId = streams[0].streamId; const streamModel = serverSession.createStreamModel(streamId); // Add the model to the cee.View this.view.addModel(streamModel); // Start the streaming if not already started. if (!streamModel.isStreamingActive()) { await streamModel.startStreaming_async(); } }
Methods
Methods
createStreamModel
-
ServerSession.createStreamModel(streamId) Arguments: - streamId (
string) – None
Creates a new
StreamModelfor the given stream id. Streaming of data into the new model is not started by default, but should be initiated by callingStreamModel.startStreaming_async.Return type: StreamModel - streamId (
destroySession
-
ServerSession.destroySession() Destroys this ServerSession instance.
This will detach all StreamModels from the session and free all resources associated with the session. After calling this method, the ServerSession instance should not be used anymore.
Return type: void
getAvailableStreams_async
-
ServerSession.getAvailableStreams_async() Gets the information about all the streams available in the VizStreamer Service. Returns a
StreamInfoarray on success, otherwise throws an error (e.g. connection problems).Return type: Promise <[StreamInfo]>