netsoul
Version:
netsoul protocol library
49 lines (35 loc) • 948 B
JavaScript
// Generated by CoffeeScript 1.6.3
(function() {
var Message, Protocol;
Message = (function() {
function Message() {}
Message.prototype.data = '';
Message.prototype.split = [];
Message.prototype.debug = function(callback) {
if (callback == null) {
callback = console.dir;
}
return callback({
data: this.data,
split: this.split
});
};
return Message;
})();
Protocol = (function() {
function Protocol() {}
Protocol.prototype.parseData = function(line) {
var message, _ref;
message = new Message;
message.line = line;
message.split = line.split(' ');
if ((_ref = message.split[0]) === 'salut' || _ref === 'ping' || _ref === 'rep') {
message.type = message.split[0];
}
return message;
};
return Protocol;
})();
module.exports = Protocol;
module.exports.Message = Message;
}).call(this);