Skip to content

Commit 3dd1585

Browse files
author
phoenix.lv
committed
remove used protobuf
1 parent 0a7a575 commit 3dd1585

1 file changed

Lines changed: 0 additions & 41 deletions

File tree

wsclient/msg.js

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,5 @@
1-
const protobuf = require("protobufjs");
21
const COMMON_TYPE = 0;
32
const WINDOWSIZE_TYPE = 1;
4-
const protofile = "channelmsg.proto";
5-
/*
6-
protobuf.load("channelmsg.proto", function(err, root) {
7-
if (err)
8-
throw err;
9-
10-
// Obtain a message type
11-
const MsgSchema = root.lookupType("jobmgr.CommonMsg");
12-
13-
// Exemplary payload
14-
let payload = { id: 0, content: "" };
15-
16-
// Verify the payload if necessary (i.e. when possibly incomplete or invalid)
17-
let errMsg = MsgSchema.verify(payload);
18-
if (errMsg)
19-
throw Error(errMsg);
20-
21-
// Create a new message
22-
let msg = MsgSchema.create(payload); // or use .fromObject if conversion is necessary
23-
console.log(msg)
24-
// Encode a message to an Uint8Array (browser) or Buffer (node)
25-
let buffer = MsgSchema.encode(msg).finish();
26-
// ... do something with buffer
27-
console.log(buffer)
28-
29-
// Decode an Uint8Array (browser) or Buffer (node) to a message
30-
let message = MsgSchema.decode(buffer);
31-
// ... do something with message
32-
console.log(message)
33-
// If the application uses length-delimited buffers, there is also encodeDelimited and decodeDelimited.
34-
35-
// Maybe convert the message back to a plain object
36-
var object = AwesomeMessage.toObject(message, {
37-
longs: String,
38-
enums: String,
39-
bytes: String,
40-
// see ConversionOptions
41-
});
42-
});
43-
*/
443

454
function commonMsg(data) {
465
return '1'+data;

0 commit comments

Comments
 (0)