Get rid of switch statements in favor of an EventEmitter-based router for message handling.

This commit is contained in:
Simo Kinnunen
2014-02-02 19:55:44 +09:00
parent ade611670e
commit 48d5648b9d
8 changed files with 224 additions and 188 deletions

View File

@@ -2,5 +2,15 @@ var path = require('path')
var ProtoBuf = require('protobufjs')
module.exports =
ProtoBuf.loadProtoFile(path.join(__dirname, 'wire.proto')).build()
var wire = ProtoBuf.loadProtoFile(path.join(__dirname, 'wire.proto')).build()
wire.ReverseMessageType = Object.keys(wire.MessageType)
.reduce(
function(acc, type) {
acc[wire.MessageType[type]] = type
return acc
}
, Object.create(null)
)
module.exports = wire