MCPcopy Create free account
hub / github.com/axmolengine/axmol / open

Method open

core/network/WebSocket.cpp:230–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230bool WebSocket::open(Delegate* delegate,
231 std::string_view url,
232 std::string_view caFilePath,
233 std::string_view protocols)
234{
235 _delegate = delegate;
236 _url = url;
237 _caFilePath = FileUtils::getInstance()->fullPathForFilename(caFilePath);
238 _requestUri = Uri::parse(url);
239 _protocols = protocols;
240 _closeCode = ws::detail::close_code::none;
241 _closeReason = "";
242
243 setupParsers();
244 generateHandshakeSecKey();
245
246 if (!_caFilePath.empty())
247 _service->set_option(YOPT_S_SSL_CACERT, _caFilePath.c_str());
248
249 _service->set_option(YOPT_C_REMOTE_ENDPOINT, 0, _requestUri.getHost().data(), (int)_requestUri.getPort());
250
251 _state = State::CONNECTING;
252 if (_requestUri.isSecure())
253 _service->open(0, YCK_SSL_CLIENT);
254 else
255 _service->open(0, YCK_TCP_CLIENT);
256
257 return true;
258}
259
260void WebSocket::purgePendingEvents()
261{

Callers 6

processResponseMethod · 0.45
lazyInitMethod · 0.45
playMethod · 0.45
onEnterMethod · 0.45
startTestCallbackMethod · 0.45
WebSocketCloseTestMethod · 0.45

Calls 7

getInstanceFunction · 0.85
fullPathForFilenameMethod · 0.80
set_optionMethod · 0.80
parseFunction · 0.50
emptyMethod · 0.45
c_strMethod · 0.45
dataMethod · 0.45

Tested by 3

onEnterMethod · 0.36
startTestCallbackMethod · 0.36
WebSocketCloseTestMethod · 0.36