Seshi API 0.1

Seshi is a web api which wrapps WebRTC & IndexedDB features from the html5 spec. It allows the decentralised storage of large files in the browser (IndexedDB), you can then send files direct to peers (WebRTC) and playback the files within the browser (e.g. Video and audio).

We (will be) launching Seshi BETA to the public soon, please register your interest to get early access when we release Seshi pro (whatever pro means these days) to fund further development.

This API is subject to change, so please be ready for some of the API calls to change, or be removed in some way as the application matures.

  • Storage: IndexedDB
  • Peer to Peer File Transfer: WebRTC Data channel
  • Media playback: Any browser supported format
  • Chat: WebRTC Data channel

TODO: Add complete example for creating peer connection using API.

API Calls

All api calls are prefixed with Seshi.<api call>

Call at any time in console to view the list of Seshi commands.

Settings Related API Calls

Storage operations

Peer to Peer operations

Media operations


Display the help menu.


Store data into Seshi's IndexedDB database.

Seshi can store data into its database directly from the users file system via an <input type="file" multiple> or receive and store data coming from a connected peer over the RTCdatachannel piece by piece.

Storing files from a file input:
var StoreReqObject =

this.files should be File object from the <input type=file ...>
Seshi will then:

  • Loop through each file the user has specified
  • Split it into small chunks
  • Store each chunk into IndexedDB.

Store data coming from a connected peer

var StoreReqObject =

Chunk must be a single Seshi chunk taken from the IndexedDB of a connected peer. This is then stored in the receiving peers' Seshi database.


Returns object containing iceConnectionState[1] & dataChannelState[1:1]

To get the iceConnectionState query: Seshi.connectionStatus.iceConnectionState()

To get the DataChannel State query:


Use this call to query the progess of files being stored into Seshi. Storing a file takes time, because Seshi chunks files into ~65k chunks.

.storeProgress Is an array of files currently being stored into Seshi indexed by their unique FileId.

You can query the keys of this array to find out the store progress of each file:

var keys = Object.keys(Seshi.storeProgress)

For example:
Seshi.storeProgress['b5ece06f-4b0a-4158-95dc-e24618a647bd'] where the index is a known FileId.

It's output is a list of the code above shows the names of files being stored and their progress:

    fileName: "video.ogv",
    currentChunk: 629, 
    totalNumChunks: 729, 
    complete: false


Remove a file from Seshi's database.


Get the list of fileIds currently in the database by calling:


.localFileList is a cached list of all files in Seshi's database. This makes it quicker to retrieve a list of all files in the database. To refresh this cache, call Seshi.updateLocalFilesList()


Returns an array of objects, one for each file. This is a cached list of file names in Seshi's data store for speed. To update the file list cache call Seshi.updateLocalFilesList()


var list = Seshi.localFileList();

Returns array of objects containing information about each file stores in Seshi:

[Object, Object, Object...];
console.log(list[0]); //Object:

Object {
    fileId: "086059ca-f03e-42a5-9ff4-0e80baab2a8c", 
boxId: "myBoxID", 
fileName: "Happy Birthday.flac", 
fileType: "audio/mp3"


Refreshes Seshi's cached .localFileList() call. It quires the entire IndexedDB for every FilId, and then reports back to Seshi.localFileList() with the most up-to-date list of files in the Data store.

This api call is intensive because it looks at every chunk in the Data Store.

The implementation of this is subject to change to improve its speed. An index will probably be added on 'FileName' of each chunk to make this faster in the future.[1:2]


A key is needed for two peers to exchange their Candidate Addresses[1:3] via a signalling server. A candidate address is basically an IP address & Port Number that a client might be able to be reached upon. This could be a local address, public IP address, Natted address, or the address of a TURN server to relay connections when a peer-to-peer connection cannot be established. See [^3]

Both peers send their candidate addresses to the signalling server, so that each peer can learn the candidate addresses of each other.

var key = Seshi.generateKey();
console.log(key); //xyz
Seshi.connect(key); //See docs

  1. ↩︎ ↩︎ ↩︎ ↩︎