ISAACOverview :: Library Doc :: Server Doc :: JSON Commands

JSON Commands

This page documents the JSON messages a client can send and receive from and to the server/visualization. All messages have in common, that they have a type, which is called likewise "type".

Incoming messages

Message type Meaning
"hello"
The first message the server sends to a connecting client telling about the capabilites of it. The message also contains
Variable name Meaning
"name"
The name of the server.
"streams"
A list with available streams and their names.
"register"
Everytime a visualization connects to the server a register-message is sent to all clients. If a client connects to a server with already connected visualizations the server resends all register messages to the new client. The server also updates the register messages while the visualization is running. Furthermore it contains:
Variable name Meaning
"name"
The name of the simulation/visualization.
"id"
The unique id of this simulation. Important for observing!
"nodes"
The number of nodes ( = mpi ranks) the simulation is running at.
"framebuffer width"
and
"framebuffer height"
The width and height of the image the client will receive.
"max functors"
The maximal number of functor per functor chain.
"functors"
A list of available functors and short descriptions, what they do.
"projection count"
Number of projection matrizes used in the visualization. Atm projection count > 1 means, that stereoscopic rendering is active.
"projection"
An array of floating point numbers, where always 16 numbers form one projection matrix. The number of elements should be projection count multiplied with 16.
"position"
Three numbers giving you the position of the camera focus point.
"rotation"
Nine numbers giving you a 3x3 rotation matrix about the rotation of the camera around the focus point.
"distance"
A number representing the distance of the focus point from the camera
"sources"
The names and descriptions of the sources the simulation defined for ISAAC.
"interpolation"
A bool, whether interpolation is activated.
"iso surface"
A bool, whether iso surface rendering is activated.
"step"
A number defining the step width for the raycasting. This is not the time step of the simulation. If you want to export this to the client use a variable in the later described "meta data" object.
"width", "height" and "depth"
The width, height and depth of the whole simulation / visualization volume
"period"
A new time step from the simulation arived! The attributes "position", "rotation", "distance", "sources", "interpolation", "iso surface" or "step" (see "register") may appear if they changed. Besides these the following attributes will appear all the time:
Variable name Meaning
"meta nr"
A unique number of the frame. Don't use this as time step as the simulation could pause, but still sent new data increasing this counter.
"metadata"
The content of this attribute is full defined from the simulation using getJsonMetaRoot(). If it's empty the simulation did not sent any meta data.
From time to time these attributes can appear as well althought they do not appear while "register".
Variable name Meaning
"payload"
The last rendered image as base64 string.
"functions"
An array with all transfer functions of the sources as strings.
"transfer points"
An array of objects, where each object has the attributes "value", "r", "g", "b", and "a", definining the colour and opacity for the given value. Value goes from 0…1.
"transfer array"
An array of arrays of 4-element-arrays definig the transfer function per source. The most inner 4-element-arrays are color and opacity values.
"weight"
An array with all weights of the sources as numbers.
"background color"
A string giving the background colour.
"clipping"
An array of 4-element-arrays, where each of these arrays defines a clipping plane.
"minmax"
An array of objects containing "min" and "max" attributes for every source of the simulation.
"eye distance"
A numbers giving you the distance of the eyes if stereoscopy is activated.
"exit"
The simulation exited

Outgoing messages

Message type Meaning
"observe"
Means, that the client wants to get "period" messages from a given simulation/visualization. For this beside the type three attributes need to be sent:
Variable name Meaning
"stream"
Number of the stream to get, you get the streams with the "hello" message of the server.
"dropable"
This is a bool, where you tell the server, whether it is okay for you not to get every update, e.g. if the network is too slow.
"observe id"
The id of the simulation you want to observe. You got this form the "register" message of the simulation.
"feedback"
This is the most imporant kind of message, to directly speak with a observed visualization, but also the simulation itself. You can (but don't have to) send these attributes
Variable name Meaning
"rotation absolute"
Sending an array of nine numbers to set a new rotation matrix. This will delete the old one. Send e.g [1,0,0,0,1,0,0,0,1] to reset the rotation.
"rotation relative"
Sending an array of nine numbers to define a rotation matrix, which will get multiplied with the old one.
"rotation axis"
Sending an array of four numbers to rotate the camera around the vector defined by the first three numbers with an angle defined by the last number. [1,0,0,90] e.g. would rotate 90° around the X-axis.
"position absolute"
Sending an array of three numbers to set the absolute position of the focus point.
"position relative"
Sending an array of three numbers to change the position of the focus point relative to its old position.
"distance absolute"
Sending a number to set the absolute distance to the focus point.
"distance relative"
Sending a number to change the distance to the focus point relative to the old distance.
"eye distance"
Sending one number to change the distance of the eyes of stereoscopy is activated.
"projection"
Sending an array of floating point numbers, where always 16 numbers form one projection matrix. The number of elements have to be projection count (see "register") multiplied with 16.
"modelview"
Sending direct a modelview matrix as 16-element-matrix.
"interpolation"
Sending bool, whether interpolation is activated.
"iso surface"
Sending bool, whether iso surface rendering is activated.
"step"
Sending number defining the step width for the raycasting.
"transfer points"
Sending an array of objects, where each object has the attributes "value", "r", "g", "b", and "a", definining the colour and opacity for the given value. Value goes from 0…1.
"functions"
Sending an array with all transfer functions of the sources as strings.
"weight"
Sending an array with all weights of the sources as numbers.
"background color"
Sending a string with the background colour.
"bounding box"
It doesn't matter, what it sent, but if something is sent the bounding box of IceT is toggled to be on if it was off and off if it was on. This is a work around as long as the IceT bounding box is buggy.
"clipping add"
Adding a new clipping plane. This needs two further attribues
Variable name Meaning
"position"
A 3-element array for the position of the plane.
"normal"
A 3-element array for the normal of the plane.
"clipping remove"
Sending a number of the clipping plane, which shall be remove starting with 0.
"clipping edit"
Editing an existing clipping plane. This needs three further attribues
Variable name Meaning
"nr"
The number of the clipping plane, which shall be edited starting with 0.
"position"
An3-element array for the position of the plane.
"normal"
A 3-element array for the normal of the plane.
"metadata"
Sending an arbitrary json object directly to the simulation, which will be able to read it with getJsonMetaRoot().
"request"
Sending a string to update some state or to redraw the image at all. The string can have the following values:
Value Meaning
"rotation"
Resend the rotation.
"position"
Resend the position.
"distance"
Resend the distance.
"projection"
Resend the projection.
"transfer"
Resend the transfer function.
"interpolation"
Resend the interpolation flag.
"step"
Resend the step width.
"iso surface"
Resend the iso surface flag.
"functions"
Resend the functor chains.
"weight"
Resend the weights per source.
"background color"
Resend the background colour.
"clipping"
Resend the clipping planes.
"controller"
Resend the controller specific attributes. Atm this means resending "eye distance" if stereoscopy is activated.
"redraw"
Redraw the image even if nothing happend.
"minmax"
Sent the min-max array for every source.
"stop"
Means, that the client wants to stop observing a simulation, so not getting "period" messages from a given simulation/visualization anymore. For this beside the type, one attribute needs to be sent:
Variable name Meaning
"observe id"
The id of the simulation you don't want to observe anymore. You got this form the "register" message of the simulation.
"closed"
Means, that the client will disconnect from the isaac server.