Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 1 | |
| 2 | var assert = require('assert'); |
| 3 | var thrift = require('thrift'); |
| 4 | var helpers = require('./helpers'); |
| 5 | var ThriftTest = require('./gen-nodejs/ThriftTest'); |
| 6 | var ThriftTestDriver = require('./test_driver').ThriftTestDriver; |
| 7 | |
| 8 | // createXHRConnection createWSConnection |
| 9 | var connection = thrift.createXHRConnection("localhost", 9090, { |
| 10 | transport: helpers.transports['buffered'], |
| 11 | protocol: helpers.protocols['json'], |
| 12 | path: '/test' |
| 13 | }); |
| 14 | |
| 15 | connection.on('error', function(err) { |
| 16 | assert(false, err); |
| 17 | }); |
| 18 | |
| 19 | // Uncomment the following line to start a websockets connection |
| 20 | // connection.open(); |
| 21 | |
| 22 | // createWSClient createXHRClient |
| 23 | var client = thrift.createXHRClient(ThriftTest, connection); |
| 24 | |
| 25 | ThriftTestDriver(client, function (status) { |
| 26 | console.log('Browser:', status); |
| 27 | }); |