Thrift Javascript Library
=========================
This browser based Apache Thrift implementation supports
RPC using the JSON protocol over Http[s] with XHR.

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.

Example
-------
The listing below demonstrates a simple browser based JavaScript
Thrift client and Node.js JavaScript server for the HelloSvc service. 

### hello.thrift - Service IDL
    service HelloSvc {
        string hello_func(),
    }

### hello.html - Browser Client
    <!doctype html>
    <html lang="en">
    <head>
        <script src="thrift.js" type="text/javascript"></script>
        <script src="gen-js/HelloSvc.js" type="text/javascript"></script>
    </head>
    <body>
        <h1>Apache Thrift JavaScript Browser Client Demo</h1>
        <button id="btn">Get Message from Node Server</button>
        <script type="text/javascript">
            document.getElementById("btn").addEventListener("click", getMessage, false);
    
            function getMessage() {
                var transport = new Thrift.Transport("http://localhost:8585");
                var protocol  = new Thrift.Protocol(transport);
                var client = new HelloSvcClient(protocol);
                var msg = client.hello_func();
                document.getElementById("output").innerHTML = msg;
            }
        </script>
        <h2>Server Response: <div id="output"></div></h2>
    </body> 
    </html>

### hello.js - Node Server
    var thrift = require('thrift');
    var TJSONProtocol = require('thrift/protocol').TJSONProtocol;
    var HelloSvc = require('./gen-nodejs/HelloSvc.js');
    
    var call_counter = 0;
        
    var server = thrift.createHttpGetPostServer(HelloSvc, {
      hello_func: function(result) {
        console.log("Client call: " + (++call_counter));
        result(null, "Hello Apache Thrift for JavaScript " + call_counter);
      }
    }, {protocol: TJSONProtocol});
    
    server.listen(8585);