mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-06-17 13:19:32 +02:00
Move WebSocketServer to be accessable from Assignment-Client:Agent only.
This commit is contained in:
parent
d3a6833133
commit
d89ecc1e42
3 changed files with 42 additions and 39 deletions
|
@ -24,6 +24,7 @@
|
|||
#include <SoundCache.h>
|
||||
#include <UUID.h>
|
||||
|
||||
#include <WebSocketServerClass.h>
|
||||
#include <EntityScriptingInterface.h> // TODO: consider moving to scriptengine.h
|
||||
|
||||
#include "avatars/ScriptableAvatar.h"
|
||||
|
@ -184,6 +185,9 @@ void Agent::run() {
|
|||
|
||||
_scriptEngine.registerGlobalObject("SoundCache", DependencyManager::get<SoundCache>().data());
|
||||
|
||||
QScriptValue webSocketServerConstructorValue = _scriptEngine.newFunction(WebSocketServerClass::constructor);
|
||||
_scriptEngine.globalObject().setProperty("WebSocketServer", webSocketServerConstructorValue);
|
||||
|
||||
auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
|
||||
|
||||
_scriptEngine.registerGlobalObject("EntityViewer", &_entityViewer);
|
||||
|
|
|
@ -61,8 +61,10 @@ unitTests.addTest("Test WebSocket invalid URL", function(finished) {
|
|||
this.assertEquals(WEBSOCKET_INVALID_URL, webSocket.url, "url should be '" + WEBSOCKET_INVALID_URL + "'");
|
||||
}, UNITTEST_TIMEOUT);
|
||||
|
||||
|
||||
unitTests.addTest("Test WebSocketServer with three clients", function(finished) {
|
||||
if (this.WebSocketServer === undefined) {
|
||||
print("Skipping WebSocketServer tests.");
|
||||
} else {
|
||||
unitTests.addTest("Test WebSocketServer with three clients", function(finished) {
|
||||
var _this = this;
|
||||
const NUMBER_OF_CLIENTS = 3;
|
||||
var connectedClients = 0;
|
||||
|
@ -95,6 +97,7 @@ unitTests.addTest("Test WebSocketServer with three clients", function(finished)
|
|||
newSocket3.onmessage = this.registerCallbackFunction(function(event) {
|
||||
newSocket3.send(event.data);
|
||||
});
|
||||
}, UNITTEST_TIMEOUT);
|
||||
}, UNITTEST_TIMEOUT);
|
||||
}
|
||||
|
||||
unitTests.run();
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include "TypedArrays.h"
|
||||
#include "XMLHttpRequestClass.h"
|
||||
#include "WebSocketClass.h"
|
||||
#include "WebSocketServerClass.h"
|
||||
|
||||
#include "SceneScriptingInterface.h"
|
||||
|
||||
|
@ -348,9 +347,6 @@ void ScriptEngine::init() {
|
|||
QScriptValue webSocketConstructorValue = newFunction(WebSocketClass::constructor);
|
||||
globalObject().setProperty("WebSocket", webSocketConstructorValue);
|
||||
|
||||
QScriptValue webSocketServerConstructorValue = newFunction(WebSocketServerClass::constructor);
|
||||
globalObject().setProperty("WebSocketServer", webSocketServerConstructorValue);
|
||||
|
||||
QScriptValue printConstructorValue = newFunction(debugPrint);
|
||||
globalObject().setProperty("print", printConstructorValue);
|
||||
|
||||
|
|
Loading…
Reference in a new issue