mirror of https://github.com/axmolengine/axmol.git
Merge pull request #15317 from pandamicro/v3
Fix Socket IO handshake issue with latest version libwebsocket
This commit is contained in:
commit
3d7d5de95d
|
@ -570,7 +570,13 @@ void WebSocket::onSubThreadStarted()
|
||||||
{
|
{
|
||||||
"permessage-deflate",
|
"permessage-deflate",
|
||||||
lws_extension_callback_pm_deflate,
|
lws_extension_callback_pm_deflate,
|
||||||
|
// iOS doesn't support client_no_context_takeover extension in the current version, it will cause iOS connection fail
|
||||||
|
// It may be a bug of lib websocket iOS build
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||||
|
"permessage-deflate; client_max_window_bits"
|
||||||
|
#else
|
||||||
"permessage-deflate; client_no_context_takeover; client_max_window_bits"
|
"permessage-deflate; client_no_context_takeover; client_max_window_bits"
|
||||||
|
#endif
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"deflate-frame",
|
"deflate-frame",
|
||||||
|
|
|
@ -17,6 +17,15 @@
|
||||||
<key>NSTemporaryExceptionMinimumTLSVersion</key>
|
<key>NSTemporaryExceptionMinimumTLSVersion</key>
|
||||||
<string>TLSv1.1</string>
|
<string>TLSv1.1</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
<key>itharbors.com</key>
|
||||||
|
<dict>
|
||||||
|
<key>NSIncludesSubdomains</key>
|
||||||
|
<true/>
|
||||||
|
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
|
||||||
|
<true/>
|
||||||
|
<key>NSTemporaryExceptionMinimumTLSVersion</key>
|
||||||
|
<string>TLSv1.1</string>
|
||||||
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
|
|
@ -125,8 +125,14 @@ var SocketIOTestLayer = cc.Layer.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
onExit: function() {
|
onExit: function() {
|
||||||
if(this._sioEndpoint) this._sioEndpoint.disconnect();
|
if(this._sioEndpoint) {
|
||||||
if(this._sioClient) this._sioClient.disconnect();
|
this._sioEndpoint.disconnect();
|
||||||
|
this._sioEndpoint = null;
|
||||||
|
}
|
||||||
|
if(this._sioClient) {
|
||||||
|
this._sioClient.disconnect();
|
||||||
|
this._sioClient = null;
|
||||||
|
}
|
||||||
|
|
||||||
this._super();
|
this._super();
|
||||||
},
|
},
|
||||||
|
@ -153,7 +159,7 @@ var SocketIOTestLayer = cc.Layer.extend({
|
||||||
onMenuSIOClientClicked: function(sender) {
|
onMenuSIOClientClicked: function(sender) {
|
||||||
|
|
||||||
//create a client by using this static method, url does not need to contain the protocol
|
//create a client by using this static method, url does not need to contain the protocol
|
||||||
var sioclient = SocketIO.connect("ws://cocos2d-x.org/assets/cpp-tests-resources:4000", {"force new connection" : true});
|
var sioclient = SocketIO.connect("ws://tools.itharbors.com:4000", {"force new connection" : true});
|
||||||
|
|
||||||
//if you need to track multiple sockets it is best to store them with tags in your own array for now
|
//if you need to track multiple sockets it is best to store them with tags in your own array for now
|
||||||
sioclient.tag = "Test Client";
|
sioclient.tag = "Test Client";
|
||||||
|
@ -193,7 +199,7 @@ var SocketIOTestLayer = cc.Layer.extend({
|
||||||
onMenuSIOEndpointClicked: function(sender) {
|
onMenuSIOEndpointClicked: function(sender) {
|
||||||
|
|
||||||
//repeat the same connection steps for the namespace "testpoint"
|
//repeat the same connection steps for the namespace "testpoint"
|
||||||
var sioendpoint = SocketIO.connect("ws://cocos2d-x.org/assets/cpp-tests-resources:4000/testpoint", {"force new connection" : true});
|
var sioendpoint = SocketIO.connect("ws://tools.itharbors.com:4000/testpoint", {"force new connection" : true});
|
||||||
|
|
||||||
//a tag to differentiate in shared callbacks
|
//a tag to differentiate in shared callbacks
|
||||||
sioendpoint.tag = "Test Endpoint";
|
sioendpoint.tag = "Test Endpoint";
|
||||||
|
@ -254,14 +260,18 @@ var SocketIOTestLayer = cc.Layer.extend({
|
||||||
|
|
||||||
onMenuTestClientDisconnectClicked: function(sender) {
|
onMenuTestClientDisconnectClicked: function(sender) {
|
||||||
|
|
||||||
if(this._sioClient != null) this._sioClient.disconnect();
|
if(this._sioClient != null) {
|
||||||
|
this._sioClient.disconnect();
|
||||||
|
this._sioClient = null;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onMenuTestEndpointDisconnectClicked: function(sender) {
|
onMenuTestEndpointDisconnectClicked: function(sender) {
|
||||||
|
|
||||||
if(this._sioEndpoint != null) this._sioEndpoint.disconnect();
|
if(this._sioEndpoint != null) {
|
||||||
|
this._sioEndpoint.disconnect();
|
||||||
|
this._sioEndpoint = null;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
toExtensionsMainLayer: function (sender) {
|
toExtensionsMainLayer: function (sender) {
|
||||||
|
|
|
@ -76,14 +76,20 @@ def main():
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if platform == 'win32':
|
if platform == 'win32':
|
||||||
x86_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.4/prebuilt', '%s' % cur_platform))
|
x86_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.5/prebuilt', '%s' % cur_platform))
|
||||||
|
if not os.path.exists(x86_llvm_path):
|
||||||
|
x86_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.4/prebuilt', '%s' % cur_platform))
|
||||||
if not os.path.exists(x86_llvm_path):
|
if not os.path.exists(x86_llvm_path):
|
||||||
x86_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.3/prebuilt', '%s' % cur_platform))
|
x86_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.3/prebuilt', '%s' % cur_platform))
|
||||||
else:
|
else:
|
||||||
x86_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.4/prebuilt', '%s-%s' % (cur_platform, 'x86')))
|
x86_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.5/prebuilt', '%s-%s' % (cur_platform, 'x86')))
|
||||||
|
if not os.path.exists(x86_llvm_path):
|
||||||
|
x86_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.4/prebuilt', '%s-%s' % (cur_platform, 'x86')))
|
||||||
if not os.path.exists(x86_llvm_path):
|
if not os.path.exists(x86_llvm_path):
|
||||||
x86_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.3/prebuilt', '%s-%s' % (cur_platform, 'x86')))
|
x86_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.3/prebuilt', '%s-%s' % (cur_platform, 'x86')))
|
||||||
x64_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.4/prebuilt', '%s-%s' % (cur_platform, 'x86_64')))
|
x64_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.5/prebuilt', '%s-%s' % (cur_platform, 'x86_64')))
|
||||||
|
if not os.path.exists(x64_llvm_path):
|
||||||
|
x64_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.4/prebuilt', '%s-%s' % (cur_platform, 'x86_64')))
|
||||||
if not os.path.exists(x64_llvm_path):
|
if not os.path.exists(x64_llvm_path):
|
||||||
x64_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.3/prebuilt', '%s-%s' % (cur_platform, 'x86_64')))
|
x64_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.3/prebuilt', '%s-%s' % (cur_platform, 'x86_64')))
|
||||||
|
|
||||||
|
@ -110,7 +116,9 @@ def main():
|
||||||
config.set('DEFAULT', 'cxxgeneratordir', cxx_generator_root)
|
config.set('DEFAULT', 'cxxgeneratordir', cxx_generator_root)
|
||||||
config.set('DEFAULT', 'extra_flags', '')
|
config.set('DEFAULT', 'extra_flags', '')
|
||||||
|
|
||||||
if '3.4' in llvm_path:
|
if '3.5' in llvm_path:
|
||||||
|
config.set('DEFAULT', 'clang_version', '3.5')
|
||||||
|
elif '3.4' in llvm_path:
|
||||||
config.set('DEFAULT', 'clang_version', '3.4')
|
config.set('DEFAULT', 'clang_version', '3.4')
|
||||||
else:
|
else:
|
||||||
config.set('DEFAULT', 'clang_version', '3.3')
|
config.set('DEFAULT', 'clang_version', '3.3')
|
||||||
|
@ -129,6 +137,7 @@ def main():
|
||||||
# set proper environment variables
|
# set proper environment variables
|
||||||
if 'linux' in platform or platform == 'darwin':
|
if 'linux' in platform or platform == 'darwin':
|
||||||
os.putenv('LD_LIBRARY_PATH', '%s/libclang' % cxx_generator_root)
|
os.putenv('LD_LIBRARY_PATH', '%s/libclang' % cxx_generator_root)
|
||||||
|
print '%s/libclang' % cxx_generator_root
|
||||||
if platform == 'win32':
|
if platform == 'win32':
|
||||||
path_env = os.environ['PATH']
|
path_env = os.environ['PATH']
|
||||||
os.putenv('PATH', r'%s;%s\libclang;%s\tools\win32;' % (path_env, cxx_generator_root, cxx_generator_root))
|
os.putenv('PATH', r'%s;%s\libclang;%s\tools\win32;' % (path_env, cxx_generator_root, cxx_generator_root))
|
||||||
|
|
Loading…
Reference in New Issue