mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-06-17 23:59:43 +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 <SoundCache.h>
|
||||||
#include <UUID.h>
|
#include <UUID.h>
|
||||||
|
|
||||||
|
#include <WebSocketServerClass.h>
|
||||||
#include <EntityScriptingInterface.h> // TODO: consider moving to scriptengine.h
|
#include <EntityScriptingInterface.h> // TODO: consider moving to scriptengine.h
|
||||||
|
|
||||||
#include "avatars/ScriptableAvatar.h"
|
#include "avatars/ScriptableAvatar.h"
|
||||||
|
@ -184,6 +185,9 @@ void Agent::run() {
|
||||||
|
|
||||||
_scriptEngine.registerGlobalObject("SoundCache", DependencyManager::get<SoundCache>().data());
|
_scriptEngine.registerGlobalObject("SoundCache", DependencyManager::get<SoundCache>().data());
|
||||||
|
|
||||||
|
QScriptValue webSocketServerConstructorValue = _scriptEngine.newFunction(WebSocketServerClass::constructor);
|
||||||
|
_scriptEngine.globalObject().setProperty("WebSocketServer", webSocketServerConstructorValue);
|
||||||
|
|
||||||
auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
|
auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
|
||||||
|
|
||||||
_scriptEngine.registerGlobalObject("EntityViewer", &_entityViewer);
|
_scriptEngine.registerGlobalObject("EntityViewer", &_entityViewer);
|
||||||
|
|
|
@ -61,7 +61,9 @@ unitTests.addTest("Test WebSocket invalid URL", function(finished) {
|
||||||
this.assertEquals(WEBSOCKET_INVALID_URL, webSocket.url, "url should be '" + WEBSOCKET_INVALID_URL + "'");
|
this.assertEquals(WEBSOCKET_INVALID_URL, webSocket.url, "url should be '" + WEBSOCKET_INVALID_URL + "'");
|
||||||
}, UNITTEST_TIMEOUT);
|
}, UNITTEST_TIMEOUT);
|
||||||
|
|
||||||
|
if (this.WebSocketServer === undefined) {
|
||||||
|
print("Skipping WebSocketServer tests.");
|
||||||
|
} else {
|
||||||
unitTests.addTest("Test WebSocketServer with three clients", function(finished) {
|
unitTests.addTest("Test WebSocketServer with three clients", function(finished) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
const NUMBER_OF_CLIENTS = 3;
|
const NUMBER_OF_CLIENTS = 3;
|
||||||
|
@ -96,5 +98,6 @@ unitTests.addTest("Test WebSocketServer with three clients", function(finished)
|
||||||
newSocket3.send(event.data);
|
newSocket3.send(event.data);
|
||||||
});
|
});
|
||||||
}, UNITTEST_TIMEOUT);
|
}, UNITTEST_TIMEOUT);
|
||||||
|
}
|
||||||
|
|
||||||
unitTests.run();
|
unitTests.run();
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
#include "TypedArrays.h"
|
#include "TypedArrays.h"
|
||||||
#include "XMLHttpRequestClass.h"
|
#include "XMLHttpRequestClass.h"
|
||||||
#include "WebSocketClass.h"
|
#include "WebSocketClass.h"
|
||||||
#include "WebSocketServerClass.h"
|
|
||||||
|
|
||||||
#include "SceneScriptingInterface.h"
|
#include "SceneScriptingInterface.h"
|
||||||
|
|
||||||
|
@ -348,9 +347,6 @@ void ScriptEngine::init() {
|
||||||
QScriptValue webSocketConstructorValue = newFunction(WebSocketClass::constructor);
|
QScriptValue webSocketConstructorValue = newFunction(WebSocketClass::constructor);
|
||||||
globalObject().setProperty("WebSocket", webSocketConstructorValue);
|
globalObject().setProperty("WebSocket", webSocketConstructorValue);
|
||||||
|
|
||||||
QScriptValue webSocketServerConstructorValue = newFunction(WebSocketServerClass::constructor);
|
|
||||||
globalObject().setProperty("WebSocketServer", webSocketServerConstructorValue);
|
|
||||||
|
|
||||||
QScriptValue printConstructorValue = newFunction(debugPrint);
|
QScriptValue printConstructorValue = newFunction(debugPrint);
|
||||||
globalObject().setProperty("print", printConstructorValue);
|
globalObject().setProperty("print", printConstructorValue);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue