Dave Young - Incremental Developments

From XPUB & Lens-Based wiki
Revision as of 21:35, 7 October 2012 by Dave Young (talk | contribs)

About

I have begun development on a simple webchat application built with nodejs, and inspired by the structure of the feedback sessions used in the communes in the early 1970s. I am interested in how they aspired to create a hyper-democratic social system built on the foundations of countercultural politics and cybernetic theory, yet failed spectacularly in this ambition.

3-10

Began looking at php/javascript chat client examples and reading tutorials in order to get a good understanding of the ideas involved with creating a basic chat application. This tutorial was useful.

4-10

Swapped to nodejs. I followed this tutorial, and I read up on the nodejs documentation.

5-10

Began to deconstruct the example from the tutorial I completed on the previous day. I removed certain parts (usernames, colours, text formatting in the chat window) that were not necessary for my intentions. In the original example, all this data is communicated between the server and client using JSON, as follows:

var obj = {
    time: (new Date()).getTime(),
    text: htmlEntities(message.utf8Data),
    author: userName,
    color: userColor
};

history.push(obj);
history = history.slice(-100);

var json = JSON.stringify({ type:'message', data: obj });
for (var i=0; i < clients.length; i++) {
    clients[i].sendUTF(json);
}

I tried to modify the JSON structure, but obviously made an error, as the code broke :(

6-10

Screenshot of chat application

I rewrote the code from the start, completely omitting any functions/variables etc that I did not need for my own application, and made a working example that I could run on a local node server. At the moment, users are unnamed authors, with no distinguishing styling features. Text is not added to the chat window in a top-to-bottom manner typical to chat clients, instead it follows left-to-right, as it would in an ordinary text editor.

An example of the current state of the experiment can be seen on the right =============>

7-10

Getting to grips with routing JSON between the server and the client. I wrote a separate script that would dynamically update the list of authors that have contributed to the text. Tomorrow I will implement this script into the chat application. I also started playing with mongoDB as a better means of storing chat data - for example, it would be valuable to store the chat logs/author lists in a database once the application is up and running.