title: Thrift transport in javascript client
body: <p>I'm trying to build a javascript client for my Thrift server. The server is up and running and I can get calls to the server working with a PHP client. I just can't figure out the javascript client.</p>
  
  <p>In particular, instantiating the transport baffles me. The tutorial at <a href="http://thrift.apache.org/tutorial/js/" rel="noreferrer">http://thrift.apache.org/tutorial/js/</a> shows:</p>
  
  <pre><code>function calc() {
      var transport = new Thrift.Transport("/thrift/service/tutorial/");
      var protocol  = new Thrift.Protocol(transport);
      var client    = new CalculatorClient(protocol);
  </code></pre>
  
  <p>When I do this, I get an http 404 on "/var/www/thrift/service/tutorial/"</p>
  
  <p>I've found one or two other examples that use</p>
  
  <pre><code>var transport = new Thrift.Transport("/service");
  </code></pre>
  
  <p>But that gives me a 404 as well.</p>
  
  <p>I've never seen an explanation of what I'm supposed to pass to the constructor of Transport in javascript. In my PHP code, I create a socket and then pass that to the constructor of the Transport. However, javascript complains that Thrift.Socket() isn't a constructor.</p>
  
  <p>The tutorial at <a href="http://thrift.apache.org/tutorial/js/" rel="noreferrer">http://thrift.apache.org/tutorial/js/</a> isn't terribly helpful. It says:</p>
  
  <blockquote>
    <p>The first thing for using the Thrift files is setting up your
    Transport protocol. At this time, it only supports AJAX and is as
    follows:</p>
  
  <pre><code>var transport = new Thrift.Transport("/thrift/service/tutorial/");
  </code></pre>
  </blockquote>
  
  <p>There's no description of what that path passed to the constructor should be.</p>
  
  <p>I'm lost on this. What do I pass to the Transport constructor in javascript?</p>