Skip to content
demo of client and server communication with nodejs, java, python, ruby
Java Python JavaScript Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
gen-java/com/shsz/young/thrift/proto
gen-nodejs
thrift-javalab
thrift-pylab
thrift-rblab
README
client.js
server.js
user.thrift

README

nodejs、java、python、ruby通过thrift 进行互相通讯

.nodejs
需要修改protocal源码支持中文UTF-8传输
参考:http://www.programup.com/article/98.html
 

.java
maven项目

.python

( 安装 egg
thrift-0.8.0\lib\py>python setup.py build
thrift-0.8.0\lib\py>python setup.py install
)

thrift.exe -out thrift-pylab --gen py user.thrift

.ruby

( 安装 gem
thrift-0.8.0\lib\rb
gem build thrift.gemspec
gem install thrift     // 不支持cygwin下的ruby
)

thrift.exe -out thrift-rblab\lib --gen rb user.thrift

注意ruby 的server版本无法使用ctrl + c 强制退出
transport = Thrift::ServerSocket.new('localhost', 9090)
如果不加localhost,默认会监听在ipv6的地址端口

需要修改protocal源码支持中文UTF-8传输
参考:https://issues.apache.org/jira/browse/THRIFT-1224
Something went wrong with that request. Please try again.