API Docs for: 2.0.0

Class server

Class defined in: server.js:11

SAGE2 server

appFileSaveRequest( wsio, data )
server.js:10650

Method handling a file save request from a SAGE2_App

Parameters:
String | Null appLaunchHelperGetPathOfApp( appName )
server.js:10054

Used to get the full path of an app starting with appName in the FileName.

Parameters:
  • appName <Object>
    • Folder name to check for the app.

Returns: <String | Null>

Either it gets the full path or null to indicate not available.

broadcast( name, data )
server.js:651

Send a message to all clients using websocket

Parameters:
  • name <String>

    name of the message

  • data <Object>

    data of the message

clearDisplay( )
server.js:3218

Remove all partitions and all applications

closeWebSocketClient( wsio )
server.js:747

Callback when a client closes

Parameters:
  • wsio <Websocket>

    websocket of the client

createPartition( dims, color )
server.js:10919

Create a new partition with a given set of dimensions and a color

Parameters:
  • dims <Object>
    • The dimensions of a partition in top, left, width, height
  • color <String>
    • The color of the partition
createPartition( id )
server.js:10946

Create a new partition with a given set of dimensions and a color

Parameters:
  • id <String>
    • The id of the partition to be deleted
deleteAllApplications( )
server.js:3229

Close all the applications

deleteAllPartitions( )
server.js:3245

Remove all the partitions and keep the applications

Boolean doOverlap( x_1, y_1, width_1, height_1, x_2, y_2, width_2, height_2 )
server.js:1880

Test if two rectangles overlap (axis-aligned)

Parameters:
  • x_1 <Integer>

    x coordinate first rectangle

  • y_1 <Integer>

    y coordinate first rectangle

  • width_1 <Integer>

    width first rectangle

  • height_1 <Integer>

    height first rectangle

  • x_2 <Integer>

    x coordinate second rectangle

  • y_2 <Integer>

    y coordinate second rectangle

  • width_2 <Integer>

    width second rectangle

  • height_2 <Integer>

    height second rectangle


Returns: <Boolean>

true if rectangles overlap

emitLog( data )
server.js:662

Print a message to all the web consoles

Parameters:
  • data <Object>

    object to print

fillContextMenuWithShareSites( contextMenu, appId )
server.js:9829

Given a context menu, will fill with appropriate share sites.

Parameters:
  • contextMenu <Object>
    • The context menu of the application.
  • appId <String>
    • Unique string to get app, SAGE2Items.applications.list[appId].
hideRadialMenu( uniqueID )
server.js:9581

Hides radial menu and enables interactivity

Parameters:
  • uniqueID <Integer>

    radial menu ID

initializeExistingAppsAudio( wsio )
server.js:1221

Ensures that new audioManager instances get metadata about all existing apps

Parameters:
  • wsio <Websocket>

    client's websocket

initializeExistingControls( wsio )
server.js:1234

Rebuilds the application widgets for a given client

Parameters:
  • wsio <Websocket>

    client's websocket

initializeExistingSagePointers( wsio )
server.js:1291

Rebuilds the pointers for a given client

Parameters:
  • wsio <Websocket>

    client's websocket

initializeExistingWallUI( wsio )
server.js:1306

Rebuilds the wall radial menu for a given client

Parameters:
  • wsio <Websocket>

    client's websocket

initializeSage2Server( )
server.js:263

initialize the SAGE2 server

initializeWSClient( wsio, reqConfig, reqVersion, reqTime, reqConsole )
server.js:946

Sends the first messages when client built

Parameters:
  • wsio <Websocket>

    client's websocket

  • reqConfig <Bool>

    client requests configuration

  • reqVersion <Bool>

    client requests version

  • reqTime <Bool>

    client requests time information

  • reqConsole <Bool>

    client requests console messages

moveRadialMenu( uniqueID, pointerX, pointerY )
server.js:9523

Translates position of a radial menu by an offset

Parameters:
  • uniqueID <Integer>

    radial menu ID

  • pointerX <Float>

    offset x position

  • pointerY <Float>

    offset y position

openWebSocketClient( wsio )
server.js:736

Callback when a client connects

Parameters:
  • wsio <Websocket>

    The websocket for this client

partitionsGrabAllContent( )
server.js:10901

Cause all apps to be associated with a partition if it is above one

ReportIfCanWallScreenshot( )
server.js:10269

Calculate if we have enough screenshot-capable display clients and send message to UI clients to enable the screenshot menu

setRadialMenuPosition( uniqueID, pointerX, pointerY )
server.js:9543

Sets the absolute position of a radial menu

Parameters:
  • uniqueID <Integer>

    radial menu ID

  • pointerX <Float>

    x position

  • pointerY <Float>

    y position

setupListeners( wsio )
server.js:1016

Installs all the message callbacks on a websocket

Parameters:
  • wsio <Websocket>

    concerned websocket

shareApplicationWithRemoteSite( uniqueID, app, remote )
server.js:8114

Shares an application with a remote site

Parameters:
  • uniqueID <String>
  • app <Object>
    • The app object to share. Usually: {application: SAGE2Items.applications.list[data.app]}
  • remote <Object>
    • Remote site. Usually: remoteSites[data.parameters.remoteSiteIndex]
showRadialMenu( uniqueID )
server.js:9565

Shows radial menu and enables interactivity

Parameters:
  • uniqueID <Integer>

    radial menu ID

wsAddClient( wsio, data )
server.js:835

Callback that configures a new client

Parameters:
  • wsio <Websocket>

    client's websocket

  • data <Object>

    initialization data

wsAppContextMenuContents( wsio, data )
server.js:9869

Received from a display client, apps will send their context menu after completing their initialization.

Parameters:
  • wsio <Object>
    • The websocket of sender.
  • data <Object>
    • The object properties described below.
    • app <String>
      • App id that this menu is for.
    • entries <Array>
      • Array of objects describing the entries.
wsCallFunctionOnApp( wsio, data )
server.js:9882

Will call a function on each display client's app that matches id. Expected usage with context menu. But can be used in other cases. There are some special functionality cases like: SAGE2DeleteElement, SAGE2SendToBack, SAGE2Maximize These do not send message to app.

Parameters:
  • wsio <Object>
    • The websocket of sender.
  • data <Object>
    • The object properties described below.
    • x <Integer>
      • Pointer x, corresponds to on entire wall.
    • y <Integer>
      • Pointer y, corresponds to on entire wall.
    • app <String>
      • App id, which function should be activated.
    • func <String>
      • Name of function to activate
    • parameters <Object>
      • Object to send to the app as parameter.
wsCreatePartition( data )
server.js:10783

Create a new screen partition with dimensions specified in data

Parameters:
  • data <Object>
    • The dimensions of the partition to be created
wsDeleteAllApplications( )
server.js:3260

Remove all applications

wsDeleteAllPartitions( )
server.js:10881

Remove all partitions

wsDisplayHardware( wsio, data )
server.js:10533

Receive data from Electron display client about their hardware

Parameters:
  • wsio <>

    The wsio

  • data <>

    The data

wsLaunchAppWithValues( wsio, data )
server.js:10002

Will launch app with specified name and call the given function after. The function doesn't need to be called to give the parameters.

Parameters:
  • wsio <Object>
    • The websocket of sender.
  • data <Object>
    • The object properties described below.
    • appName <String>
      • Folder name to check for the app.
    • params <Object>
      • Will be passed to the app. Function too, it is specified.
    • func <String>
      • Optional, if specified, will also call this funciton and pass parameters.
wsPartitionScreen( data )
server.js:10798

Create a new screen partition with dimensions specified in data

Parameters:
  • data <Object>
    • Contains the layout specificiation with which partitions will be created
wsPartitionsGrabAllContent( )
server.js:10890

Cause all apps to be associated with a partition if it is above one (WebSocket method)

wsPerformanceData( wsio, data )
server.js:10545

Receive data from Electron display client about their hardware

Parameters:
  • wsio <>

    The wsio

  • data <>

    The data

wsRequestAppContextMenu( wsio, data )
server.js:9775

Asks server for the context menu of an app. Server will send the current known menu. Menus must be sumitted by app, or the default "Not yet loaded" will be displayed. To use context menu an app MUST have been loaded on a master display.

Parameters:
  • wsio <Object>
    • The websocket of sender.
  • data <Object>
    • The object needed to get menu, properties described below.
    • x <Integer>
      • Pointer x, corresponds to on entire wall.
    • y <Integer>
      • Pointer y, corresponds to on entire wall.
    • xClick <Integer>
      • Where client clicked on their screen, because this is async.
    • yClick <Integer>
      • Where client clicked on their screen, because this is async.
wsSaveDataOnServer( wsio, data )
server.js:10107

Used to write files into the media folders. Writes to a joined location of mainFolder.path(~/Documents/SAGE2_media)

Parameters:
  • wsio <Object>
    • The websocket of sender.
  • data <Object>
    • The object properties described below.
    • fileName <String>
      • Name of the file.
    • fileType <String>
      • Extension of the file.
    • fileContent <String>
      • To be written in the file.
wsSendDataToClient( wsio, data )
server.js:10075

Sends data to a specific client or set.

Parameters:
  • wsio <Object>
    • The websocket of sender.
  • data <Object>
    • The object properties described below.
    • clientDest <String>
      • Unique identifier of client
wsServerDataGetAllTrackedDescriptions( wsio, data )
server.js:10241

Will respond back once to the app giving the func an array of tracked descriptions. They will be in an array of objects with properties nameOfValue and description.

Parameters:
  • wsio <Object>
    • The websocket of sender.
  • data <Object>
    • The object properties described below.
    • app <String>
      • App that requested.
    • func <String>
      • Name of the function on the app to give value to.
wsServerDataGetAllTrackedValues( wsio, data )
server.js:10226

Will respond back once to the app giving the func an array of tracked values. They will be in an array of objects with properties nameOfValue and value. NOTE: the values in the array could be huge.

Parameters:
  • wsio <Object>
    • The websocket of sender.
  • data <Object>
    • The object properties described below.
    • app <String>
      • App that requested.
    • func <String>
      • Name of the function on the app to give value to.
wsServerDataGetValue( wsio, data )
server.js:10187

Checks if there is a value, and if so will send the value. If the value doesn't exist, it will not return anything.

Parameters:
  • wsio <Object>
    • The websocket of sender.
  • data <Object>
    • The object properties described below.
wsServerDataRemoveValue( wsio, data )
server.js:10199

Removes variable from server. Expected usage is this is called when an app closes. Made for the sake of cleanup as apps open and close.

Parameters:
  • wsio <Object>
    • The websocket of sender.
  • data <Object>
    • The object properties described below.
wsServerDataSetValue( wsio, data )
server.js:10176

Sets the value of specified server data. If it doesn't exist, will create it.

Parameters:
  • wsio <Object>
    • The websocket of sender.
  • data <Object>
    • The object properties described below.
wsServerDataSubscribeToNewValueNotification( wsio, data )
server.js:10255

Will add the websocket to subscriber list of new value notifications. The subscriber will get an object with nameOfValue and description.

Parameters:
  • wsio <Object>
    • The websocket of sender.
  • data <Object>
    • The object properties described below.
    • app <String>
      • App that requested.
    • func <String>
      • Name of the function on the app to give value to.
wsServerDataSubscribeToValue( wsio, data )
server.js:10211

Add the app to the named values a subscriber. If the value doesn't exist, it will create a "blank" value and subscribe to it.

Parameters:
  • wsio <Object>
    • The websocket of sender.
  • data <Object>
    • The object properties described below.
    • nameOfValue <String>
      • Name of value to subscribe to.
    • app <String>
      • App that requested.
    • func <String>
      • Name of the function on the app to give value to.
wsStartJupyterSharing( wsio, data )
server.js:10559

Start a jupyter connection

Parameters:
wsStartWallScreenshot( wsio, data )
server.js:10290

Sent from UI, server gets it and tells displays to send back screenshots. Only happens if a screenshot is not already in progress to prevent spam. The masterDisplay check in array is reset (discarded) and rebuilt.

Parameters:
wsVoiceToAction( wsio, data )
server.js:10967

Will attempt to take a transcript and use best case to activate a context menu item. All logic is performed within the src/voiceToAction.js file.

Parameters:
  • wsio <Object>
    • ws to originator.
  • data <Object>
    • should contain words.
wsWallScreenshotFromDisplay( wsio, data )
server.js:10330

Called when displays are sending screenshots. Displays that are not capable of screenshots will report back saying so. Performs the following: if not display, stop if display is not capable, mark status, stop get all displays in array save the current display's screenshot mark this display in the correct check in position if display has width and height, mark those locations too if all display tiles screenshots have been submitted OR all displays have submitted a screenshot or are incapable then make a screenshot done with mosaic and offset tiles based on config information stitching is done in tmp folder to avoid problems caused by the folder monitor finally reset variable to allow another screenshot

Parameters: