Open ksuprynowicz opened 5 months ago
It doesn't show how to open websocket server on a given port, even though this is possible and it's extremely important feature.
Relevant C++ code:
ScriptValue WebSocketServerClass::constructor(ScriptContext* context, ScriptEngine* engine) { // the serverName is used in handshakes QString serverName = QStringLiteral("HighFidelity - Scripted WebSocket Listener"); // port 0 will auto-assign a free port quint16 port = 0; ScriptValue callee = context->callee(); if (context->argumentCount() > 0) { ScriptValue options = context->argument(0); ScriptValue portOption = options.property(QStringLiteral("port")); if (portOption.isValid() && portOption.isNumber()) { port = portOption.toNumber(); } ScriptValue serverNameOption = options.property(QStringLiteral("serverName")); if (serverNameOption.isValid() && serverNameOption.isString()) { serverName = serverNameOption.toString(); } } return engine->newQObject(new WebSocketServerClass(engine, serverName, port), ScriptEngine::ScriptOwnership); }
Dev meeting: we should think about whether this has security implications
It doesn't show how to open websocket server on a given port, even though this is possible and it's extremely important feature.
Relevant C++ code: