My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
JS  
Styx client library written in the JavaScript.
Phase-Implementation, Featured
Updated Feb 4, 2010 by ostap.ch...@gmail.com

Web applications can use this library to connect to remote Styx servers right from the browser and talk Styx or 9P over HTTP(S). The corresponding web server (e.g. ModLM) transmits Styx messages to the server and back handling the necessary encoding.

If you don't know what is a Styx client and server you can start with:

... imagine you have a remote FS mounted to your browser and a simple API to access it.

Browser support matrix:

Browser Version Supported
Firefox 2 yes
Safari 3 yes
Internet Explorer 6 not yet
Internet Explorer 7 not yet
Opera ? ?

We will port the library to other browsers in the future.

High Level Interface

Consider the following code snippet in JavaScript (e.g. some HTML page):

var fs = new StyxFS("/styx", ehandler);
fs.mount("someone", "/net");

var dns = fs.open("/dns", Mode.ORDWR);

var msg = new Message([]);
msg.addString("code.google.com ip");

fs.write(dns, 0, msg.getBytes());
msg = new Message(fs.read(dns, 0, 16));

var ip = msg.getString(0);

There is also a working example, which is able to connect to some Styx server and list the root directory contents. ModLM page describes how to install and run the sample application.

Implementation

The JavaScript module consists of the following components:

  • styx-fs.js -- high level interface to the Styx protocol
  • styx-protocol.js -- Styx protocol implementation
  • connection.js -- low level communication
  • message.js -- binary data message
  • types.js -- type definitions and constants

Connection uses XMLHttpRequest object to implement the actual data exchange.

TBD


Sign in to add a comment
Powered by Google Project Hosting