This example shows how to use cocos2d-js/html-ajax to transfer protocol buffers/json/queryString in HTTP with NodeJS/SpringMVC
- Set up dependencies:
npm install
- Copy the cocos2d-js
frameworks
to cocos2d-js directory - Run:
node server.js
- Open
http://localhost:3000
in a recent browser
- Import project to your
Eclipse
- Convert to
Maven Project
- Run on
Server (jetty or tomcat)
, make sure your server context path is/
and port is3000
- Open
http://localhost:3000
in a recent browser
below is the TestProtobuf.proto
package TestProtobuf;
option java_package = "com.why.game.protobuf";
option java_outer_classname = "TestProtobuf";
message TestProto{
optional int32 id = 1;
optional string name = 2;
}
you will see below Snapshots when you visit http://localhost:3000
you can click the link to visit Cocos2d-JS-Protobuf
or Html-Ajax-Protobuf
as below
in the Html-Ajax-Protobuf
page you can choose protocol to see how the NodeJS and Java/SpringMVC process protobuf/json/queryString