cost 106 ms
為什么 Protobuf blob 比 JSON 等價物重?

[英]Why is the Protobuf blob heavier than the JSON equivalent?

我正在嘗試使用 protobuf 來加速我的前端和后端之間的數據傳輸。 作為 POC,我嘗試加載一個 JSON 文件,將其轉換為 protobuf 緩沖區,並將結果保存在一個新文件中。 但事實證明,新文件比 JSON 文件重。 我做錯什么了嗎? 這是我的文件:// input.proto syn ...

protobufjs 編碼一個包裝消息,其中包含一個類型為 google.protobuf.Any 的內部字段

[英]protobufjs encode a wrapper message which includes an inner field with type google.protobuf.Any

我在 Nodejs 中使用 protobufjs 庫向 kafka 主題發送消息並從 java 消費者讀取消息。 以下是 protobuf 定義。 Inner 消息應該打包在 Wrapper 消息字段中。 我使用以下三種方法對消息進行編碼,但在反序列化時出現錯誤“任何消息的類型與給定的 class ...

將共享的 protobuf package 導入到不同的 protobuf 包中

[英]Import shared protobuf package into different protobuf packages

我正在為一個項目設計一些protobuf模式,我想要的是有獨立的包,和一個共享的 package。請看下面的例子。 我嘗試了上述方法來設計我需要的東西,但是它不起作用,出現錯誤Import Error: ./shared.proto is not found or has some error 現在 ...

ProtoBuf - 一個字段可以支持兩種可能的數據類型嗎?

[英]ProtoBuf - Can a field support two possible datatypes?

protobuf 中的一個字段是否有可能支持/接受字符串或字符串數組。 這是我的信息: 它是動態的原因是因為字符串數組或簡單字符串可以作為輸入。 如果有效載荷是 string[] 或 string,則有不同的方法來處理會發生什么。 現在,我正在使用any但我不確定在any文件中做什么。 我讀過o ...

`Could not make proto path relative` 為 protoc.js

[英]`Could not make proto path relative` for protoc.js

問題在我的 C++ 項目中,我使用 protobuf 通過調用protobuf_generate_cpp cmake 宏來生成一些文件。 生成的make文件如下: 這有效,文件層次結構是: 當我使用emcmake和emmake構建同一個項目時,我得到了生成的 make 文件: 但我得到了錯誤: 但 ...

protobuf.js 使用 CommonJS?

[英]protobuf.js using CommonJS?

我對 JS 比較陌生,但對 protobuf 非常熟悉。 我目前正在設計從 Java HTTP 服務器托管的 web 頁面,並希望在它們之間實現 protobuf 通信。 我的問題在瀏覽器端。 經過一番研究,我發現了protobuf.js git 頁面並嘗試在我的 javascript 中使用它。 ...

值是對象數組的地圖的 Protobuf 結構?

[英]Protobuf structure for a map where the value is an array of objects?

我正在尋找在protobuf中編碼這樣的地圖: 該值是一個對象數組,它們都具有相同的接口(帶有一個可選條目): 我的問題是我將如何將此地圖編碼為 protobuf 消息中的字段。 還是我應該將地圖轉換為另一種格式? 這是使用 protobuf.js npm 模塊。 ...

Protobuf:將 protobuf 消息從 Javascript 傳遞到 C++ WebAssembly 模塊

[英]Protobuf : pass protobuf message from Javascript to C++ WebAssembly module

我想將 Javascript 的 protobuf 消息傳遞給 C++ WebAssembly 模塊。 我確實收到並可以在 C++ 端成功解析更簡單的 protobuf 消息,但是,protobuf 無法解析不太簡單的 protobuf 消息。 這是我正在使用的代碼:goog.module('pro ...

如何實際看到 protobuf 在網絡或文件中傳遞一些字節?

[英]How to actually see protobuf passing some bytes across, either on the network or in a file?

我是 protobuf 的新手,想通過網絡或文件傳遞一些數據來試驗它,例如 字節可以由Python / Ruby寫入文件,然后由JavaScript讀回嗎? (或者可以全部用 JavaScript 編寫)。 我認為能夠在本地網站上傳遞它可能要復雜得多? 如果是這樣,將其寫入文件並能夠讀回就可以了 ...

帶有簽名的 4 字節 int 的前綴 protobuf 消息

[英]Prefix protobuf message with signed 4 byte int

我正在使用 Websocket API ,我將 protobuf 對象發送到。 文檔說: 服務器對二進制數據使用 Big Endian 格式。 來回發送的消息需要一個有符號的 4 字節 int 的消息大小,作為消息的前綴因此有效負載應該是一個 4 字節的 int,其中包含消息大小,然后是消息本身。 ...

當它們具有相同的名稱時,如何強制 typescript 將參數解釋為命名空間而不是 class - gRPC

[英]How to force typescript to interpret a parameter as a namespace rather than a class, when they have the same name - gRPC

抱歉標題太長了... 我正在使用 gRPC 和 typescript 實現一個簡單的小系統,我的問題是:自動生成的文件為我的protoFile中的每個參數創建了一個 class 和一個類型,例如:UserId 參數生成一個帶有 getUserId 的 ZA2F2ED4F8EBC2CBB14C21A ...

有什么方法可以按標簽解碼/編碼,但在 protobuf.js 中沒有任何 .proto 文件或 json 文件?

[英]Is there any way to decode/encode by tag but without any .proto file or json file in protobuf.js?

有什么方法可以按標簽解碼/編碼,但在 protobuf.js 中沒有任何 .proto 文件或 json 文件? 或者其他圖書館? 像:// read value by tag var pb = new Protobufjs.Reader(buffer); var value = pb.readI ...

可以使用 protobuf 發布到 Apollo 服務器嗎?

[英]Possible to post to Apollo server with protobuf?

我正在開發一個項目,該項目目前使用 protobuf 從客戶端與 api 進行通信。 我想做一個概念證明,顯示通過 graphql 進行的通信,並且想知道是否可以將 protobuf 發送到 apollo 服務器而不是 json。 還詢問了阿波羅服務器的頻譜: https://spectrum.c ...

Typescript 枚舉作為接口

[英]Typescript enums as interfaces

我正在使用一個用於 TS 生成的庫(ts-protoc-gen),它為枚舉生成以下內容: 我應該如何消費它? 它如何在不初始化的情況下導出 const? ...


 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM