Qk/Sadira is aimed to be an ECMAScript(JS)/C++ scientific application framework running on Node.js servers and web-browsers. Its goal is to provide to existing data processing applications:
The main 'inaccessible' goal of Quarklib is to provide the scientific community with a magic tool automatically wrapping an interactive application (providing rich user-interface, data and process sharing via a peer to peer communication protocol, ...) on top of the everyday mess of the [astro]-physicist researcher : flags, strange data files, numbers, vectors, functions, images, n-cubes, complex pipeline logic, database access, custom exotic algorithms in whatever language, etc...
ECMAScript has become a powerfull high-level language with its increasing just-in-time compilation and hardware-acceleration features on web browser's and server interpretors. This actual mix of "JS-enabled" technologies available on the browser provides a powerfull, theoretically platform-agnostic user-interface consisting in rich html dom content, hardware-accelerated WebGL/WebCL computations and new possibilities of client/server socket programming with websockets and webrtc.
From this renewed viewpoint, sadira is the latest implementation of the Quarklib project, now using JS-based server and client code and the latest web technologies to create a reasonably-low codeline, still powerfull system, in comparison with the corresponding native c++/ui-toolkit implementation. A pure web application has the natural advantage to be installation-free, consult-only based, web-storage can be used to recover UI state, furthermore, web applications are natively multi-platform. In fine, web browsers are becoming the operating systems of user-interractive, virtual machines/workstations, in a peer to peer network.
This work is curently realised at the INAF, IASF-Bologna, in Italy, funded by the GLORIA project, a EU commission program.
The core of sadira is its binary communication protocol, permitting the exchange of arbitrarilly complex data between either Node.js servers or web browsers using WebSockets or the newer WebRTC datachanels. sadira allows browsers and node.js servers to communicate with each other. Using WebRTC datachannels, sadira will be used as the core of peer to peer applications running between web browsers and node.js servers.
The actual support of webRTC and particulary the datachannel part is still very limited right now in curent web browsers, but this technology will surely be broadly available in a near future.
For performance and bandwidth usage reasons, data need to be exchanged in binary form. ArrayBuffer support in web browser opened the way to custom binary handling of data. sadira uses BSON to encode the data of JavaScript objects transfered within dialogs in a binary efficient way. Too large binary objects need also to be serialized in packets, sometimes asynchronously, to avoid congestionning.
Templates are the lego brick and assemblies describing a project's data,processing pipelines, and user interfaces. From the user point of view, they are simple JavaScript objects,
var example_template = {};
Some properties have a special meaning. To specify child objects, the elements object property must be used :
var example_template = {
elements : {
child1 : {},
child2 : {}
}
};
The sadira server, within Gloria, must be able to respond to standard AJAX (get) requests, to be embeddedable in non-websocket aware environment and also to conform with the specs. For the Gloria 'get interface', the server must respond to a query url with a single buffer of binary data, containing both image metadata (width, height, name, etc...) and binary pixel data.
It is not possible to use the astrojs fits.js library to read from an arraybuffer from scratch, so we cannot just ajax-download the whole fits file as an ArrayBuffer and read it client side with fits.js.
One of the core sadira class exists for the purpose of encoding metadata and binary data into a single 'datagram' binary buffer :
https://github.com/Nunkiii/sadira/blob/master/www/js/datagram.js
The file can be included in node.js and browsers. The datagram embed a BSON encoded header + an arbitrary binary data packet into a 'datagram' binary buffer, received in the browser as an ArrayBuffer. Datagrams are the 'words' transmitted inside 'dialogs' :
https://github.com/Nunkiii/sadira/blob/master/www/js/dialog.js
, dialogs ocuring within a websocket or a webrtc datachanel connexion.
The datagrams can also be used for binary AJAX GET requests. In the Gloria 'get' server case, it can also be used to encode the binary replies of the gloria image data GET requests, allowing to pass image name, width, height,... in a BSON encoded header, along with the pixel binary float32 ArrayBuffer data.
Big binary buffers cannot be transfered in one piece, they need to be sliced in packets and reconstructed server side before beeing used. This is the scope of the serializer classes in sadira. It manages a stream of datagrams containing pieces of the final object. When done with datagram grabbing, the serializer notifies the client application with the reconstructed object data.
Git clone or download the zip project's file.
To do.