# 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_async` method is used to get the information about all available streams. These streams can be subsequently used to create `StreamModel` instance(s) with the method `createStreamModel`.

  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:8080");
      // Get the available streams
      const streams = await serverSession.getAvailableStreams_async();

      if (streams[0]) {
          const streamName = streams[0].streamName;
          const streamModel = serverSession.createStreamModel(streamName);

          // Add the model to the cee.View
          this.view.addModel(streamModel);
          // Start the streaming if not already started.
          if (!streamModel.isStreamingActive()) {
              streamModel.startStreaming();
          }
      }

Methods

- `createStreamModel`
- `getAvailableStreams_async`
- `getServerUrl`
- `createInstance_async`

## Methods

### createStreamModel

`ServerSession.``createStreamModel`(streamName)

  Arguments: | streamName (`string`) – None

  Creates a new `StreamModel` from the given stream name. The streaming is started immediately upon creation.

  Return type: | StreamModel

### getAvailableStreams_async

`ServerSession.``getAvailableStreams_async`()

  Gets the information about all the streams available in the VizStreamer Service. Returns a `StreamInfo` array on success, otherwise throws an error (e.g. connection problems).

  Return type: | Promise <[StreamInfo]>

### getServerUrl

`ServerSession.``getServerUrl`()

  Gets the server url.

  Return type: | string

### static createInstance_async

`ServerSession.``createInstance_async`(serverUrl)

  Arguments: | serverUrl (`string`) – The url on which the Visualization Streamer service resides, e.g. `http://localhost:8080`

  Creates a new ServerSession instance.

  Return type: | Promise <ServerSession>

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your Docs generative AI assistant. Ask me anything about HOOPS Envision for Web or choose a sample question below to start a conversation:

What is HOOPS Envision for Web?
What are the latest release notes for HOOPS Envision for Web?
How do I start evaluating HOOPS Envision for Web?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...