MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / makeWebSocketServer

Function makeWebSocketServer

modules/dasHV/src/dasHV.cpp:525–544  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

523}
524
525Handle<hv::WebSocketServer> makeWebSocketServer ( int port, int httpsPort, const char * pathToCert, const void * pClass, const StructInfo * info, Context * context, LineInfoArg * at ) {
526 if ( httpsPort ) {
527 hssl_ctx_init_param_t param;
528 memset(&param, 0, sizeof(param));
529 string crt_root = pathToCert ? pathToCert : getDasRoot() + "/modules/dasHV/cert";
530 auto crt_file = crt_root + "/server.crt";
531 auto key_file = crt_root + "/server.key";
532 param.crt_file = crt_file.c_str();
533 param.key_file = key_file.c_str();
534 param.endpoint = HSSL_SERVER;
535 if (hssl_ctx_init(&param) == NULL) {
536 context->throw_error_at(at, "libHV: hssl_ctx_init failed! Please check the certificate files `%s` and `%s`.", crt_file.c_str(), key_file.c_str());
537 }
538 }
539 auto adapter = new WebServer_Adapter((char *)pClass,info,context);
540 adapter->port = port;
541 adapter->https_port = httpsPort;
542 shared_ptr<hv::WebSocketServer> sp(adapter);
543 return HandleRegistry<hv::WebSocketServer>::instance().acquire(sp);
544}
545
546int das_wss_send ( Handle<hv::WebSocketChannel> h, const char * msg, ws_opcode opcode, bool fin ) {
547 auto p = HandleRegistry<hv::WebSocketChannel>::instance().lookup(h);

Callers

nothing calls this directly

Calls 4

getDasRootFunction · 0.85
throw_error_atMethod · 0.80
acquireMethod · 0.80
c_strMethod · 0.45

Tested by

no test coverage detected