fix(core): update
This commit is contained in:
		
							
								
								
									
										4
									
								
								ts/interfaces/universeconnection.interfaces.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								ts/interfaces/universeconnection.interfaces.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| export interface IAuthenticationRequest { | ||||
|   channelName: string; | ||||
|   password: string; | ||||
| } | ||||
| @@ -95,12 +95,12 @@ export class Universe { | ||||
|     const SubscriptionSocketFunction = new plugins.smartsocket.SocketFunction({ | ||||
|       allowedRoles: [ClientRole], // there is only one client role, Authentication happens on another level | ||||
|       funcName: 'channelSubscription', | ||||
|       funcDef: async (dataArg, socketConnectionArg) => { | ||||
|       funcDef: async (dataArg: interfaces.IServerCallSubscribeActionPayload, socketConnectionArg) => { | ||||
|         // run in "this context" of this class | ||||
|         (() => { | ||||
|           // TODO: properly add the connection | ||||
|           const universeConnection = new UniverseConnection({ | ||||
|              | ||||
|             authenticationRequest:  | ||||
|           }) | ||||
|           this.universeConnectionManager.addConnection(); | ||||
|         })(); | ||||
|   | ||||
| @@ -5,21 +5,29 @@ import { UniverseChannel } from './smartuniverse.classes.universechannel'; | ||||
|  * represents a connection to the universe | ||||
|  */ | ||||
| export class UniverseConnection { | ||||
|   public terminatedDeferred = plugins.smartpromise.defer(); | ||||
|  | ||||
|  | ||||
|   /** | ||||
|    * the socketClient to ping | ||||
|    */ | ||||
|   public socketConnection: plugins.smartsocket.SocketConnection; | ||||
|   public authenticationRequests = [] | ||||
|   public authenticationRequests = []; | ||||
|   public subscribedChannels: UniverseChannel[] = []; | ||||
|   public authenticatedChannels: UniverseChannel[] = []; | ||||
|   public failedToJoinChannels: UniverseChannel[] = []; | ||||
|  | ||||
|   /** | ||||
|    * terminates the connection | ||||
|    */ | ||||
|   public terminateConnection () { | ||||
|     this.socketConnection | ||||
|     this.socketConnection.socket.disconnect(); | ||||
|     this.terminatedDeferred.resolve(); | ||||
|   } | ||||
|  | ||||
|   constructor(optionsArg: { | ||||
|     socketConnection: plugins.smartsocket.SocketConnection; | ||||
|     authenticationRequests | ||||
|   }) { | ||||
|     this.socketConnection, | ||||
|   } | ||||
|   | ||||
| @@ -7,5 +7,23 @@ import { UniverseConnection } from './smartuniverse.classes.universeconnection'; | ||||
| export class UniverseConnectionManager { | ||||
|   public connectionMap = new plugins.lik.Objectmap<UniverseConnection>(); | ||||
|  | ||||
|   public addConnection() {} | ||||
|   public async addConnection(universeConnectionArg: UniverseConnection) { | ||||
|     let universeConnection = universeConnectionArg; | ||||
|     universeConnection = await this.deduplicateUniverseConnection(universeConnection); | ||||
|     universeConnection = this.authenticateAuthenticationRequests(); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * deduplicates UniverseConnections | ||||
|    */ | ||||
|   public deduplicateUniverseConnection (universeConnectionArg: UniverseConnection): Promise<UniverseConnection> { | ||||
|  | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * authenticate AuthenticationRequests | ||||
|    */ | ||||
|   public authenticateAuthenticationRequests(universeConnectionArg) { | ||||
|  | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user