1.0.3 • Published 6 years ago
protobuf-plugin v1.0.3
pomelo-protobuf-plugin
protobuf-plugin is a plugin for pomelo, it can be used in pomelo(>=0.9).
protobuf-plugin provides messages encode&decode service for pomelo, and it uses ProtoBuf.js to do this thing.
##Installation
npm install protobuf-plugin
##Usage
the protos file should use json format, for it would be compatible for pomelo-protobuf. If you use proto file, you can use ProtoBuf.js to turn it to json file.
the default protos files are and /config/clientProtos.json, serverProtos:/config/serversProtos.json clientProtos:/config/serversProtos.json serverPBPath:/config/protoFile/serverProto.proto clientPBPath:/config/protoFile/clientProto.proto serverCheckPath:/config/protoFile/serverCheck.proto clientCheckPath:/config/protoFile/serverCheck.proto
and you can specify your own protos files.
var protobuf = require('pomelo-protobuf-plugin');
app.use(protobuf, {
protobuf: {
// serverProtos: /yourprotofilepath/
// clientProtos: /yourprotofilepath/
// serverPBPath: /yourprotofilepath/
// clientPBPath: /yourprotofilepath/
// serverCheckPath: /yourprotofilepath/
// clientCheckPath: /yourprotofilepath/
}
});