websocket默认读取ssl证书
This commit is contained in:
parent
a642639485
commit
21b8354194
@ -262,7 +262,7 @@ void JSB_WebSocketDelegate::setJSDelegate(const se::Value& jsDelegate)
|
||||
|
||||
static bool WebSocket_finalize(se::State& s)
|
||||
{
|
||||
WebSocket* cobj = (WebSocket*)s.nativeThisObject();
|
||||
auto* cobj = (WebSocket*)s.nativeThisObject();
|
||||
CCLOGINFO("jsbindings: finalizing JS object %p (WebSocket)", cobj);
|
||||
|
||||
// Manually close if web socket is not closed
|
||||
@ -334,7 +334,7 @@ static bool WebSocket_constructor(se::State& s)
|
||||
}
|
||||
|
||||
cobj = new (std::nothrow) WebSocket();
|
||||
JSB_WebSocketDelegate* delegate = new (std::nothrow) JSB_WebSocketDelegate();
|
||||
auto* delegate = new (std::nothrow) JSB_WebSocketDelegate();
|
||||
if (cobj->init(*delegate, url, &protocols, caFilePath))
|
||||
{
|
||||
delegate->setJSDelegate(se::Value(obj, true));
|
||||
@ -352,8 +352,9 @@ static bool WebSocket_constructor(se::State& s)
|
||||
else
|
||||
{
|
||||
cobj = new (std::nothrow) WebSocket();
|
||||
JSB_WebSocketDelegate* delegate = new (std::nothrow) JSB_WebSocketDelegate();
|
||||
if (cobj->init(*delegate, url))
|
||||
std::string caFilePath = "cacert.pem";
|
||||
auto* delegate = new (std::nothrow) JSB_WebSocketDelegate();
|
||||
if (cobj->init(*delegate, url, nullptr, caFilePath))
|
||||
{
|
||||
delegate->setJSDelegate(se::Value(obj, true));
|
||||
cobj->retain(); // release in finalize function and onClose delegate method
|
||||
@ -395,8 +396,8 @@ static bool WebSocket_send(se::State& s)
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
WebSocket* cobj = (WebSocket*)s.nativeThisObject();
|
||||
bool ok = false;
|
||||
auto* cobj = (WebSocket*)s.nativeThisObject();
|
||||
bool ok;
|
||||
if (args[0].isString())
|
||||
{
|
||||
std::string data;
|
||||
@ -452,7 +453,7 @@ static bool WebSocket_close(se::State& s)
|
||||
const auto& args = s.args();
|
||||
int argc = (int)args.size();
|
||||
|
||||
WebSocket* cobj = (WebSocket*)s.nativeThisObject();
|
||||
auto* cobj = (WebSocket*)s.nativeThisObject();
|
||||
if(argc == 0)
|
||||
{
|
||||
cobj->closeAsync();
|
||||
@ -510,7 +511,7 @@ static bool WebSocket_getReadyState(se::State& s)
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
WebSocket* cobj = (WebSocket*)s.nativeThisObject();
|
||||
auto* cobj = (WebSocket*)s.nativeThisObject();
|
||||
s.rval().setInt32((int)cobj->getReadyState());
|
||||
return true;
|
||||
}
|
||||
@ -526,7 +527,7 @@ static bool WebSocket_getBufferedAmount(se::State& s)
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
WebSocket* cobj = (WebSocket*)s.nativeThisObject();
|
||||
auto* cobj = (WebSocket*)s.nativeThisObject();
|
||||
s.rval().setUint32((uint32_t)cobj->getBufferedAmount());
|
||||
return true;
|
||||
}
|
||||
@ -542,7 +543,7 @@ static bool WebSocket_getExtensions(se::State& s)
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
WebSocket* cobj = (WebSocket*)s.nativeThisObject();
|
||||
auto* cobj = (WebSocket*)s.nativeThisObject();
|
||||
s.rval().setString(cobj->getExtensions());
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user