# CloudSession

class `cee.``CloudSession`()

  The CloudSession’s responsibility is to manage the `Viewers` and the main event loop of EnvisionWeb (`handleAnimationFrameCallback`).

  All EnvisionWeb applications need a CloudSession object. There is only need for one, even in apps with multiple viewers, views, models and remote servers.

Constructors

- `constructor`

Accessors

- `buildDateTimeString`
- `version`
- `viewerCount`

Methods

- `addModelToProcessingSet`
- `addViewer`
- `deleteAllViewers`
- `deleteViewerAt`
- `destroySession`
- `getViewerArray`
- `getViewerAt`
- `handleAnimationFrameCallback`
- `removeModelFromProcessingSet`

## Constructors

`CloudSession.``constructor`()

  Constructor

  Return type: | CloudSession

## Accessors

`CloudSession.``buildDateTimeString`()

  Returns the date and time this version of EnvisionWeb was built

  Return type: | string

`CloudSession.``version`()

  Returns the version of HOOPS Envision for Web

  Format: Major.Minor.Patch-Build. E.g. ‘1.2.0+34145A’ or ‘1.2.0-rc1++38C14A

  Return type: | string

`CloudSession.``viewerCount`()

  Returns the number of viewers in the client application.

  Return type: | number

## Methods

### addModelToProcessingSet

`CloudSession.``addModelToProcessingSet`(model)

  Arguments: | model (`ProcessableModel`) – None

  Manually add a model to the set of models that need background processing

  Return type: | void

### addViewer

`CloudSession.``addViewer`(canvas[, viewerOptions])

  Arguments: | canvas (`HTMLCanvasElement`) – None viewerOptions (`ViewerOptions`) – optional None

  Adds a new Viewer to the session.

  The Viewer is tied to a HTML Canvas element, and the provided canvas must be capable of rendering WebGL. Returns null if the canvas is not capable of rendering WebGL or if WebGL resources are exhausted.

  A Viewer can have many `Views`, and all the Views within a Viewer can share WebGL resources. So, to show the same Model in two Views, using one Viewer with two Views is more efficient than using two Viewers with one View each.

  A client application can contain many Viewers, but each Viewer must be linked to single unique Canvas.

  Return type: | Viewer

### deleteAllViewers

`CloudSession.``deleteAllViewers`()

  Deletes all viewers from the app.

  Return type: | void

### deleteViewerAt

`CloudSession.``deleteViewerAt`(index)

  Arguments: | index (`number`) – None

  Deletes the viewer at the given index.

  The index must be zero based and between 0 and viewerCount - 1

  Return type: | void

### destroySession

`CloudSession.``destroySession`()

  Destroys the session object. This will delete all the viewers.

  Return type: | void

### getViewerArray

`CloudSession.``getViewerArray`()

  Returns a read only array with all viewers in the session

  Return type: | unknown

### getViewerAt

`CloudSession.``getViewerAt`(index)

  Arguments: | index (`number`) – None

  Returns the viewer with the given index.

  The index must be zero based and between 0 and viewerCount - 1

  Return type: | Viewer

### handleAnimationFrameCallback

`CloudSession.``handleAnimationFrameCallback`(highResTimestamp_ms)

  Arguments: | highResTimestamp_ms (`number`) – None

  Mandatory update method for the HOOPS Envision Client.

  This method must be called from a requestAnimationFrame() for animations to run and server communication to work as expected.

  The standard code for doing this is:

      // Setup timer to keep the session viewer up-to-date
      function myAnimationFrameCallback(highResTimestamp) {
          mySession.handleAnimationFrameCallback(highResTimestamp);
          requestAnimationFrame(myAnimationFrameCallback);
      }

      requestAnimationFrame(myAnimationFrameCallback);

  Return type: | boolean

### removeModelFromProcessingSet

`CloudSession.``removeModelFromProcessingSet`(model)

  Arguments: | model (`ProcessableModel`) – None

  Remove a model that was previously added manually to the processing set

  Return type: | void

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your multilingual generative AI assistant for documentation. Ask me anything about HOOPS Envision for Web in your own language, 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...