js-binary | Encode/decode to a custom binary format | JSON Processing library
kandi X-RAY | js-binary Summary
kandi X-RAY | js-binary Summary
Encode/decode to a custom binary format, much more compact and faster than JSON/BSON.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of js-binary
js-binary Key Features
js-binary Examples and Code Snippets
Community Discussions
Trending Discussions on js-binary
QUESTION
I hope I don't have misunderstood the Thrift concept, but what I see from (example) questions like this, this framework is composed by different modular layers that can be enabled or disabled.
I'm mostly interesed in the "IDL part" of Thrift, so that I can create a common interface between my C++ code and an external Javascript application. I would like to call C++ functions using JS, with Binary data transmission, and I've already used the compiler for this.
But both my C++ (the server) and JS (client) application already exchange data using a C++ Webserver with Websockets support, it is not provided by Thrift.
So I was thinking to setup the following items:
In JS (already done):
- TWebSocketTransport to send data to my "Websocket server" (with host ws://xxx.xxx.xxx.xxx)
- TBinaryProtocol to encapsulate the data (using this JS implementation)
- The compiled Thrift JS library with the correspondent C++ functions to call (done with the JS compiler)
In C++ (partial):
- TBinaryProtocol to encode/decode the data
- A TProcessor with handler to get the data from the client and process it
For now, the client is already able to sent requests to my websocket server, I see receiving them in binary form and I just need Thrift to:
- Decode the input
- Call the appropriate C++ function
- Encode the output
My webserver will send the response to the client. So no "Thrift server" is needed here. I see there is the TProcessor->process() function, I'm trying to use it when I receive the binary data but it needs an in/out TProtocol. No problem here... but in order to create the TBinaryProtocol I also need a TTransport! If no Thrift server is expected... what Transport should I use?
I tried to set TTransport to NULL in TBinaryProtocol constructor, but once I use it it gives nullptr exception.
Code is something like:
Init:
...ANSWER
Answered 2019-Jun-19 at 13:32I've managed to do it using the following components:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install js-binary
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page