Using Sofa in your browser

21 May Using Sofa in your browser

The SOFA TCP Server is an TCP server that exposes an interface similar to the interface of SOFA Front-end. With it, it becomes possible to easily use SOFA from any programming language, on any OS, on any platform, … and even on your current browser !


A typical configuration is composed of a server, which runs the simulation, and a client which operates on it. The client can be placed on the same computer than the server, or anywhere else on the internet. It can be coded in C++, using our SFE TCP library, or it can be coded with any other language, as far as the small communication protocol with the server is recoded.

As for an example, we have coded a small SOFA client in javascript, that allows to visualize a remote scene and interact (a bit) with it. You can see it in the following page:

TCP Client Sofa


The advantages of using SOFA TCP Server in your project can be many:

not linking with Sofa

With such a configuration, your application acts like a client and does not directly links to SOFA. That means your application is smaller, is easier to maintain and easier to test. Other advantages are that you can update the version of SOFA without having to update or modify your application, and that you can recover easily from any crash caused in SOFA.

using any programming language

The protocol with the server is quite simple and mimics the interface of SFE. It is therefore easy to recode it directly in your application, using your preferred programming language: C#, C, java, python, … Virtually any language can be used, even javascript.

several SOFA simulations in a single application

Because the SOFA library uses a lot of singletons, it is usually not possible to have several simulations running simultaneously in a single application. However, a TCP client could easily connect to several SOFA servers and control or monitor them simultaneously.

using sofa from a distant client

Because we are using TCP, the client and the server do not need to be placed on the same computer, and not even in the same room. This can be useful if you want to use a specific robotic or haptic device, or if your target platform does not support the burden of a complex SOFA simulation. Another application could be if you want to visualize your simulation from a tablet in the operating room.

several users visualising or interacting on the same simulation.

The SOFA TCP Server can support simultaneous connections from different clients. Therefore, it is possible for various applications or for various users to share a common simulation. One could imagine one client for the control of haptic device, one client for displaying the scene graph and interactively modifying some parameters of the simulation, and several clients to visualize the simulation.



No Comments

Sorry, the comment form is closed at this time.