function socket(user, url) {
    this.user = user;
    this.io = (url ? io(url) : io('http://socketio.1473.cn/'));
}

socket.prototype = {
    join: function (house, fn) {//房间 用户
        this.io.on(house, fn);
        this.io.emit("join", { type: "join", house: house, from: this.user });

    },
    send: function (data, house) {
        this.io.emit("send", { type: "send", house: house, from: this.user, data: data });
    },
    exit: function (house) {
        this.io.emit("exit", { type: "exit", house: house, from: this.user });
    },
    list: function (house, fn) {
        this.io.emit("list", { type: "exit", house: house, from: this.user });
        this.io.on(socket.io.id, fn);
    }
}
