Skip to content
This repository has been archived by the owner on Aug 30, 2019. It is now read-only.

akira-cn/cocos2dx-cqwrap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 

Repository files navigation

CQWrap

Extensions for cocos2d-x javascript bindings.

1. WebSocket for cocos2d-x

Export websocket api in javascript for cocos2d-x javascript bindings.

based on:

[http://git.warmcat.com/cgi-bin/cgit/libwebsockets/]

[http://sourceforge.net/projects/jsoncpp/]

var host = "ws://localhost:8080/test";
var ws = new WebSocket(host,'default-protocol'); // create the web socket
ws.onopen = function () {
   cc.log("connected... ", 'success'); // we are in! :D
};

ws.onmessage = function (evt) {
   cc.log(evt.data, 'response'); // we got some data - show it omg!!
};

ws.onclose = function () {
   // the socket was closed (this could be an error or simply that there is no server)
   cc.log("Socket closed!", 'error'); 
};

About

javascript binding extensions for cocos2d-x

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published