This example requires a browser that supports the HTML5 <canvas> feature.

SceneJS WebSockets Example 1

Pulling content into a scene through a WebSocket


The teapot you see here is defined within a subgraph that has been pulled into the scene graph by a SceneJS.Socket node.

The Socket node sends a createTeapot request to the WebSocket server, which responds with a chunk of json that defines the subgraph. The subgraph contains the teapot, nested within a couple of modelling transforms, one of which is a rotation about the Y-axis.

Then the Socket node sends a rotateTeapot request, and the server responds to that with json that specifies a new value for the rotation's angle.


SceneJS Log: