Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
8c30f294bc | |||
228eb791b7 | |||
057476ae66 | |||
cb80e4dc2e |
29
.vscode/launch.json
vendored
Normal file
29
.vscode/launch.json
vendored
Normal 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
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartuniverse",
|
||||
"version": "1.0.50",
|
||||
"version": "1.0.52",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -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",
|
||||
|
@ -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);
|
||||
})();
|
||||
}
|
||||
});
|
||||
|
@ -29,6 +29,7 @@ export class UniverseConnection {
|
||||
socketConnection: plugins.smartsocket.SocketConnection;
|
||||
authenticationRequests
|
||||
}) {
|
||||
this.socketConnection,
|
||||
// TODO: check if this is correct
|
||||
this.socketConnection.socket.disconnect();
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user