fix(core): update

This commit is contained in:
Philipp Kunz 2019-11-03 20:23:22 +01:00
parent a4a8959b74
commit e67b3e50cc
5 changed files with 346 additions and 395 deletions

699
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -15,9 +15,9 @@
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.17",
"@gitzone/tstest": "^1.0.24",
"@gitzone/tstest": "^1.0.28",
"@pushrocks/tapbundle": "^3.0.13",
"@types/node": "^12.7.4",
"@types/node": "^12.12.5",
"tslint": "^5.20.0",
"tslint-config-prettier": "^1.18.0"
},
@ -27,15 +27,15 @@
"dependencies": {
"@apiglobal/typedrequest-interfaces": "^1.0.7",
"@pushrocks/lik": "^3.0.11",
"@pushrocks/smartdelay": "^2.0.3",
"@pushrocks/smartexpress": "^3.0.40",
"@pushrocks/smartfile": "^7.0.4",
"@pushrocks/smartdelay": "^2.0.6",
"@pushrocks/smartexpress": "^3.0.52",
"@pushrocks/smartfile": "^7.0.6",
"@pushrocks/smarthash": "^2.0.6",
"@pushrocks/smartlog": "^2.0.19",
"@pushrocks/smartpromise": "^3.0.2",
"@pushrocks/smartrequest": "^1.1.27",
"@pushrocks/smartlog": "^2.0.21",
"@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartrequest": "^1.1.42",
"@pushrocks/smartrx": "^2.0.5",
"@pushrocks/smartsocket": "^1.1.49",
"@pushrocks/smartsocket": "^1.1.51",
"@pushrocks/smarttime": "^3.0.12",
"@pushrocks/smartunique": "^3.0.1"
},

View File

@ -21,7 +21,7 @@ export interface IClientOptions {
export class ClientUniverse {
public options;
public smartsocketClient: plugins.smartsocket.SmartsocketClient;
public observableIntake: plugins.smartrx.ObservableIntake<ClientUniverseMessage<any>>;
public messageRxjsSubject = new plugins.smartrx.rxjs.Subject<ClientUniverseMessage<any>>();
public clientUniverseCache = new ClientUniverseCache();
constructor(optionsArg: IClientOptions) {
@ -78,6 +78,7 @@ export class ClientUniverse {
public async stop() {
await this.smartsocketClient.disconnect();
this.smartsocketClient = null;
}
/**
@ -85,7 +86,7 @@ export class ClientUniverse {
* since password validation is done through other means, a connection should always be possible
*/
public async checkConnection(): Promise<void> {
if (!this.smartsocketClient && !this.observableIntake) {
if (!this.smartsocketClient) {
const parsedURL = url.parse(this.options.serverAddress);
const socketConfig: plugins.smartsocket.ISmartsocketClientOptions = {
alias: 'universeclient',
@ -95,7 +96,6 @@ export class ClientUniverse {
url: parsedURL.protocol + '//' + parsedURL.hostname
};
this.smartsocketClient = new SmartsocketClient(socketConfig);
this.observableIntake = new plugins.smartrx.ObservableIntake();
// lets define some basic actions
@ -105,8 +105,14 @@ export class ClientUniverse {
const socketFunctionUnsubscribe = new plugins.smartsocket.SocketFunction({
funcName: 'unsubscribe',
allowedRoles: [],
funcDef: async (data: interfaces.IServerUnsubscribeActionPayload) => {
throw new Error('TODO');
funcDef: async (dataArg: interfaces.IServerUnsubscribeActionPayload) => {
const channel = this.clientUniverseCache.channelMap.find(channelArg => {
return channelArg.name === dataArg.name;
});
if (channel) {
channel.unsubscribe();
}
return {};
}
});
@ -123,7 +129,7 @@ export class ClientUniverse {
const clientUniverseMessage = ClientUniverseMessage.createMessageFromMessageDescriptor(
messageDescriptorArg
);
this.observableIntake.push(clientUniverseMessage);
this.messageRxjsSubject.next(clientUniverseMessage);
// lets find the corresponding channel
const targetChannel = this.getChannel(clientUniverseMessage.targetChannelName);

View File

@ -63,6 +63,10 @@ export class ClientUniverseChannel implements interfaces.IUniverseChannel {
);
}
public unsubscribe() {
// TODO: unsubscribe all users
}
public async populateSubscriptionToServer() {
// lets make sure the channel is connected
if (this.status === 'unsubscribed') {

View File

@ -26,7 +26,7 @@ export class UniverseConnection {
universeConnection
);
universeRef.universeCache.connectionMap.add(universeConnection);
console.log('hi')
console.log('hi');
}
/**