From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:45:59 +0200 Subject: Adding upstream version 16.2.11+ds. Signed-off-by: Daniel Baumann --- src/jaegertracing/thrift/lib/js/README.md | 145 ++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 src/jaegertracing/thrift/lib/js/README.md (limited to 'src/jaegertracing/thrift/lib/js/README.md') diff --git a/src/jaegertracing/thrift/lib/js/README.md b/src/jaegertracing/thrift/lib/js/README.md new file mode 100644 index 000000000..5c7a1c23b --- /dev/null +++ b/src/jaegertracing/thrift/lib/js/README.md @@ -0,0 +1,145 @@ +Thrift Javascript Library +========================= +This browser based Apache Thrift implementation supports +RPC clients using the JSON protocol over Http[s] with XHR +and WebSocket. + +License +------- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. + +Grunt Build +------------ +This is the base directory for the Apache Thrift JavaScript +library. This directory contains a Gruntfile.js and a +package.json. Many of the build and test tools used here +require a recent version of Node.js to be installed. To +install the support files for the Grunt build tool execute +the command: + + npm install + +This reads the package.json and pulls in the appropriate +sources from the internet. To build the JavaScript branch +of Apache Thrift execute the command: + + npx grunt + +This runs the grunt build tool (from within `./node_modules/.bin/`), +linting all of the source files, setting up and running the +tests, concatenating and minifying the main libraries and +generating the html documentation. + +Tree +---- +The following directories are present (some only after the +grunt build): + /src - The JavaScript Apache Thrift source + /doc - HTML documentation + /dist - Distribution files (thrift.js and thrift.min.js) + /test - Various tests, this is a good place to look for + example code + /node_modules - Build support files installed by npm + + +Example JavaScript Client and Server +------------------------------------ +The listing below demonstrates a simple browser based JavaScript +Thrift client and Node.js JavaScript server for the hello_svc +service. + +### hello.thrift - Service IDL +### build with: $ thrift -gen js -gen js:node hello.thrift + service hello_svc { + string get_message(1: string name) + } + +### hello.html - Browser Client + + + + + Hello Thrift + + + Name: + +
+ + + + + + + +### hello.js - Node Server + var thrift = require('thrift'); + var hello_svc = require('./gen-nodejs/hello_svc.js'); + + var hello_handler = { + get_message: function(name, result) { + var msg = "Hello " + name + "!"; + result(null, msg); + } + } + + var hello_svc_opt = { + transport: thrift.TBufferedTransport, + protocol: thrift.TJSONProtocol, + processor: hello_svc, + handler: hello_handler + }; + + var server_opt = { + staticFilePath: ".", + services: { + "/hello": hello_svc_opt + } + } + + var server = Thrift.createWebServer(server_opt); + var port = 9099; + server.listen(port); + console.log("Http/Thrift Server running on port: " + port); + + +TypeScript +------------------------------------ +TypeScript definition files can also be generated by running: + + thrift --gen js:ts file.thrift + +# Breaking Changes + +## 0.13.0 + +1. 64-bit integer constants are now generatd using node-int64 e.g.: var x = new Int64("7fffffffffffffff"); -- cgit v1.2.3