Skip to content
Making 9P accessible to the web
C JavaScript PHP
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


The Web9 Project
You will find three directories: Net_9P, js9p and php9p when you check out the
web9 sources. js9p corresponds to the JavaScript implemetation of 9P, while php9p
is the PHP binding to libixp. Net_9P is a (currently incomplete) implementation
of 9P in pure PHP.

php9p is a PHP 5.2+ extension that works on POSIX systems only. The extension exports
two classes IxpClient and IxpServer for you to access and create 9P filesystems. The
documentation for them is incomplete, please have a look in the php9p/examples
directory for sample usage. Read the INSTALL file for instructions on installing php9p.

js9p consists of three parts. The main file is js9p.js which exports the JS9P.Base 
object. The object provides methods to encode and decode the 14 types of 9P messages.
Encoded messages are returned either as raw, unpacked strings or as Base64-encoded
strings. You can control endian-ness and Base64'edness using the JS9P.Base.setBigEndian
and JS9P.Base.setBase64 methods. By default, Base64 encoding is turned on and all
data is encoded in the little-endian format.

Once messages are created, you actually need some transport to send it via. JS9P provides
two methods of doing do.

Angled is a firefox extension to access 9P resources. It uses JS9P.Base and provides its
own JS9P.Angled object to communicate with a 9P server via XPCOM's sockets. The extension
handles all URI's beginning with ninep://

XHR provides the JS9P.XHR object which is responsible for sending messages generated by
JS9P.Base via an XMLHttpRequest. Naturally, you'd need a listener on the HTTP server,
which is provided by listener.php. Messages generated by JS9P.Base are collected by
JS9P.XHR and sent as a comma-seperated list of Base64 encoded messages to listener.php.
listener.php then sends those messages via a TCP socket to the 9P server and records
responses into a JSON-encoded array in Base64 format. JS9P.XHR then calls JS9P.Base to
decode the messages one-by-one. Note that XHR is a very inefficient transport, as you
need to perform the version and attach messages everytime a new request is generated.

Web9 is licensed under the MIT license.
(C) 2007, Anant Narayanan

You can find the latest version of the code at:

Drop me a mail:
	anant <at> kix <dot> in
Something went wrong with that request. Please try again.