mirror of https://github.com/axmolengine/axmol.git
Fix Socket IO connection issue on iOS
This commit is contained in:
parent
7e87b8b389
commit
d93fbea0f6
|
@ -558,7 +558,13 @@ void WebSocket::onSubThreadStarted()
|
|||
{
|
||||
"permessage-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"
|
||||
#endif
|
||||
},
|
||||
{
|
||||
"deflate-frame",
|
||||
|
|
|
@ -17,6 +17,15 @@
|
|||
<key>NSTemporaryExceptionMinimumTLSVersion</key>
|
||||
<string>TLSv1.1</string>
|
||||
</dict>
|
||||
<key>itharbors.com</key>
|
||||
<dict>
|
||||
<key>NSIncludesSubdomains</key>
|
||||
<true/>
|
||||
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
<key>NSTemporaryExceptionMinimumTLSVersion</key>
|
||||
<string>TLSv1.1</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
|
|
|
@ -125,8 +125,14 @@ var SocketIOTestLayer = cc.Layer.extend({
|
|||
},
|
||||
|
||||
onExit: function() {
|
||||
if(this._sioEndpoint) this._sioEndpoint.disconnect();
|
||||
if(this._sioClient) this._sioClient.disconnect();
|
||||
if(this._sioEndpoint) {
|
||||
this._sioEndpoint.disconnect();
|
||||
this._sioEndpoint = null;
|
||||
}
|
||||
if(this._sioClient) {
|
||||
this._sioClient.disconnect();
|
||||
this._sioClient = null;
|
||||
}
|
||||
|
||||
this._super();
|
||||
},
|
||||
|
@ -153,7 +159,7 @@ var SocketIOTestLayer = cc.Layer.extend({
|
|||
onMenuSIOClientClicked: function(sender) {
|
||||
|
||||
//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
|
||||
sioclient.tag = "Test Client";
|
||||
|
@ -193,7 +199,7 @@ var SocketIOTestLayer = cc.Layer.extend({
|
|||
onMenuSIOEndpointClicked: function(sender) {
|
||||
|
||||
//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
|
||||
sioendpoint.tag = "Test Endpoint";
|
||||
|
@ -254,14 +260,18 @@ var SocketIOTestLayer = cc.Layer.extend({
|
|||
|
||||
onMenuTestClientDisconnectClicked: function(sender) {
|
||||
|
||||
if(this._sioClient != null) this._sioClient.disconnect();
|
||||
|
||||
if(this._sioClient != null) {
|
||||
this._sioClient.disconnect();
|
||||
this._sioClient = null;
|
||||
}
|
||||
},
|
||||
|
||||
onMenuTestEndpointDisconnectClicked: function(sender) {
|
||||
|
||||
if(this._sioEndpoint != null) this._sioEndpoint.disconnect();
|
||||
|
||||
if(this._sioEndpoint != null) {
|
||||
this._sioEndpoint.disconnect();
|
||||
this._sioEndpoint = null;
|
||||
}
|
||||
},
|
||||
|
||||
toExtensionsMainLayer: function (sender) {
|
||||
|
|
Loading…
Reference in New Issue