I have been asked by one of our PhD students to create an experiment that can measure whether or not a participant will intervene in a scenario of cyber-bullying played out via Instant Messaging. The participant will believe that they are monitoring a real chatroom, and they will have certain pre-configured actions that they can perform, ranging from offering a “virtual hug” to a chat room member, to asking someone to leave the chatroom. They will not however be able to participate in the conversation beyond these predefined actions.
In reality the participant will see a scripted exchange between 3 fictitious characters, that builds up to one of the characters being treated in a bullying way. The researcher wants to know if the participant intervened, and if so what intervention they chose, whether they chose to comfort the person being bullied or confront the bullies, and how long it takes them to intervene.
There seemed to me to be lots of ways we could achieve this in technical terms. My first reaction was that we could use Adobe Air to create an application that looked exactly like a desktop chat client, and then program the scripted exchange, and pre-configured interventions directly into the application. This would mean that we wouldn’t necessarily need an internet connection (so it could be done anyone with a laptop). However it seemed like a lot of work to code up a whole interface for a standalone experiment.
The solution I opted for in the end was to use the XMPP protocol, with a standalone XMPP server running locally on a laptop. This allowed us to use an existing desktop client used for real IM chats, connecting to the server locally without an internet connection. I then used Python to write automated chat bots with the capacity to perform the scenario based on a script supplied by the researcher. This saved a lot of effort writing a custom GUI, meaning that the only code I had to write was the chat bot code in Python and a plugin to the desktop client to provide intervention buttons.
To do this I am using OpenFire (http://www.igniterealtime.org/projects/openfire/) as the server, Spark (http://www.igniterealtime.org/projects/spark/index.jsp) as the client, and a Python library that I have written and posted to GitHub called XMPPScriptBot (https://github.com/ctrlspc/XMPPScriptBot) to provide the chat bots. Conceptually the process looks like this:
I haven’t quite finished the XMPPScriptBot library yet, but it basically works, the final piece of the puzzle is to write the Spark Plugin to provide the intervention buttons, I will post later when it is all up and running (hopefully with a screencast!)