Skip to content

Commit

Permalink
Removed the deprecated storage stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
miksago committed Mar 25, 2011
1 parent 777b435 commit d07e0f1
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions test/manual/chat-server.js
Expand Up @@ -2,7 +2,7 @@ var sys = require("sys")
, http = require("http")
, fs = require("fs")
, path = require("path")
, ws = require('../lib/ws/server');
, ws = require('../../lib/ws/server');

var httpServer = http.createServer(function(req, res){
if(req.method == "GET"){
Expand Down Expand Up @@ -39,28 +39,14 @@ server.addListener("listening", function(){

// Handle WebSocket Requests
server.addListener("connection", function(conn){
conn.storage.set("username", "user_"+conn.id);

conn.send("** Connected as: user_"+conn.id);
conn.send("** Type `/nick USERNAME` to change your username");

conn.broadcast("** "+conn.storage.get("username")+" connected");
conn.broadcast("** "+conn.id+" connected");

conn.addListener("message", function(message){
if(message[0] == "/"){
// set username
if((matches = message.match(/^\/nick (\w+)$/i)) && matches[1]){
conn.storage.set("username", matches[1]);
conn.send("** you are now known as: "+matches[1]);

// get message count
} else if(/^\/stats/.test(message)){
conn.send("** you have sent "+conn.storage.get("messages", 0)+" messages.");
}
} else {
conn.storage.incr("messages");
server.broadcast(conn.storage.get("username")+": "+message);
}
server.broadcast(conn.id+": "+message);
});
});

Expand Down

0 comments on commit d07e0f1

Please sign in to comment.