wildfire chat server source initial submit

This commit is contained in:
heavyrain2012
2019-03-16 17:04:23 +08:00
parent e59217bd10
commit cab3ca0916
1466 changed files with 528862 additions and 15919 deletions
+25
View File
@@ -0,0 +1,25 @@
// this example demonstrates how to use the reader/writer interface directly to read and write the
// protobuf wire format.
/*eslint-disable strict, no-console*/
var protobuf = require("../runtime"); // require("protobufjs/runtime");
// writing
var buffer = protobuf.Writer.create()
.uint32((1 << 3 | 2) >>> 0) // id 1, wireType 2
.string("hello world!")
.finish();
// reading
var reader = protobuf.Reader.create(buffer);
while (reader.pos < reader.len) {
var tag = reader.uint32();
switch (/*id*/ tag >>> 3) {
case 1:
console.log(reader.string());
break;
default:
reader.skipType(/*wireType*/ tag & 7);
break;
}
}