Compare commits

..

4 Commits

Author SHA1 Message Date
8c30f294bc 1.0.52 2019-06-11 03:06:18 +02:00
228eb791b7 fix(core): update 2019-06-11 03:06:17 +02:00
057476ae66 1.0.51 2019-06-10 17:46:07 +02:00
cb80e4dc2e fix(core): update 2019-06-10 17:46:06 +02:00
6 changed files with 58 additions and 8 deletions

29
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,29 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "current file",
"type": "node",
"request": "launch",
"args": [
"${relativeFile}"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "test.ts",
"type": "node",
"request": "launch",
"args": [
"test/test.ts"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
}
]
}

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartuniverse",
"version": "1.0.50",
"version": "1.0.52",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartuniverse",
"version": "1.0.50",
"version": "1.0.52",
"private": false,
"description": "messaging service for your micro services",
"main": "dist/index.js",

View File

@ -100,9 +100,10 @@ export class Universe {
(() => {
// TODO: properly add the connection
const universeConnection = new UniverseConnection({
authenticationRequest:
socketConnection: socketConnectionArg,
authenticationRequests: []
})
this.universeConnectionManager.addConnection();
this.universeConnectionManager.addConnection(universeConnection);
})();
}
});

View File

@ -29,6 +29,7 @@ export class UniverseConnection {
socketConnection: plugins.smartsocket.SocketConnection;
authenticationRequests
}) {
this.socketConnection,
// TODO: check if this is correct
this.socketConnection.socket.disconnect();
}
}

View File

@ -10,20 +10,39 @@ export class UniverseConnectionManager {
public async addConnection(universeConnectionArg: UniverseConnection) {
let universeConnection = universeConnectionArg;
universeConnection = await this.deduplicateUniverseConnection(universeConnection);
universeConnection = this.authenticateAuthenticationRequests();
universeConnection = await this.authenticateAuthenticationRequests(universeConnection);
}
/**
* deduplicates UniverseConnections
*/
public deduplicateUniverseConnection (universeConnectionArg: UniverseConnection): Promise<UniverseConnection> {
public async deduplicateUniverseConnection (universeConnectionArg: UniverseConnection): Promise<UniverseConnection> {
let connectionToReturn: UniverseConnection;
this.connectionMap.forEach(async existingConnection => {
if (existingConnection.socketConnection = universeConnectionArg.socketConnection) {
connectionToReturn = await this.mergeUniverseConnections(existingConnection, universeConnectionArg);
}
});
if (!connectionToReturn) {
connectionToReturn = universeConnectionArg;
}
return connectionToReturn;
}
/**
* authenticate AuthenticationRequests
*/
public authenticateAuthenticationRequests(universeConnectionArg) {
public authenticateAuthenticationRequests(universeConnectionArg): Promise<UniverseConnection> {
// TODO: authenticate connections
return universeConnectionArg;
}
/**
* merges two UniverseConnections
*/
public mergeUniverseConnections (connectionArg1: UniverseConnection, connectionArg2: UniverseConnection) {
// TODO: merge connections
return connectionArg1;
}
}