fix(core): update
This commit is contained in:
parent
a4a8959b74
commit
e67b3e50cc
699
package-lock.json
generated
699
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@ -15,9 +15,9 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.17",
|
"@gitzone/tsbuild": "^2.1.17",
|
||||||
"@gitzone/tstest": "^1.0.24",
|
"@gitzone/tstest": "^1.0.28",
|
||||||
"@pushrocks/tapbundle": "^3.0.13",
|
"@pushrocks/tapbundle": "^3.0.13",
|
||||||
"@types/node": "^12.7.4",
|
"@types/node": "^12.12.5",
|
||||||
"tslint": "^5.20.0",
|
"tslint": "^5.20.0",
|
||||||
"tslint-config-prettier": "^1.18.0"
|
"tslint-config-prettier": "^1.18.0"
|
||||||
},
|
},
|
||||||
@ -27,15 +27,15 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apiglobal/typedrequest-interfaces": "^1.0.7",
|
"@apiglobal/typedrequest-interfaces": "^1.0.7",
|
||||||
"@pushrocks/lik": "^3.0.11",
|
"@pushrocks/lik": "^3.0.11",
|
||||||
"@pushrocks/smartdelay": "^2.0.3",
|
"@pushrocks/smartdelay": "^2.0.6",
|
||||||
"@pushrocks/smartexpress": "^3.0.40",
|
"@pushrocks/smartexpress": "^3.0.52",
|
||||||
"@pushrocks/smartfile": "^7.0.4",
|
"@pushrocks/smartfile": "^7.0.6",
|
||||||
"@pushrocks/smarthash": "^2.0.6",
|
"@pushrocks/smarthash": "^2.0.6",
|
||||||
"@pushrocks/smartlog": "^2.0.19",
|
"@pushrocks/smartlog": "^2.0.21",
|
||||||
"@pushrocks/smartpromise": "^3.0.2",
|
"@pushrocks/smartpromise": "^3.0.6",
|
||||||
"@pushrocks/smartrequest": "^1.1.27",
|
"@pushrocks/smartrequest": "^1.1.42",
|
||||||
"@pushrocks/smartrx": "^2.0.5",
|
"@pushrocks/smartrx": "^2.0.5",
|
||||||
"@pushrocks/smartsocket": "^1.1.49",
|
"@pushrocks/smartsocket": "^1.1.51",
|
||||||
"@pushrocks/smarttime": "^3.0.12",
|
"@pushrocks/smarttime": "^3.0.12",
|
||||||
"@pushrocks/smartunique": "^3.0.1"
|
"@pushrocks/smartunique": "^3.0.1"
|
||||||
},
|
},
|
||||||
|
@ -21,7 +21,7 @@ export interface IClientOptions {
|
|||||||
export class ClientUniverse {
|
export class ClientUniverse {
|
||||||
public options;
|
public options;
|
||||||
public smartsocketClient: plugins.smartsocket.SmartsocketClient;
|
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();
|
public clientUniverseCache = new ClientUniverseCache();
|
||||||
|
|
||||||
constructor(optionsArg: IClientOptions) {
|
constructor(optionsArg: IClientOptions) {
|
||||||
@ -78,6 +78,7 @@ export class ClientUniverse {
|
|||||||
|
|
||||||
public async stop() {
|
public async stop() {
|
||||||
await this.smartsocketClient.disconnect();
|
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
|
* since password validation is done through other means, a connection should always be possible
|
||||||
*/
|
*/
|
||||||
public async checkConnection(): Promise<void> {
|
public async checkConnection(): Promise<void> {
|
||||||
if (!this.smartsocketClient && !this.observableIntake) {
|
if (!this.smartsocketClient) {
|
||||||
const parsedURL = url.parse(this.options.serverAddress);
|
const parsedURL = url.parse(this.options.serverAddress);
|
||||||
const socketConfig: plugins.smartsocket.ISmartsocketClientOptions = {
|
const socketConfig: plugins.smartsocket.ISmartsocketClientOptions = {
|
||||||
alias: 'universeclient',
|
alias: 'universeclient',
|
||||||
@ -95,7 +96,6 @@ export class ClientUniverse {
|
|||||||
url: parsedURL.protocol + '//' + parsedURL.hostname
|
url: parsedURL.protocol + '//' + parsedURL.hostname
|
||||||
};
|
};
|
||||||
this.smartsocketClient = new SmartsocketClient(socketConfig);
|
this.smartsocketClient = new SmartsocketClient(socketConfig);
|
||||||
this.observableIntake = new plugins.smartrx.ObservableIntake();
|
|
||||||
|
|
||||||
// lets define some basic actions
|
// lets define some basic actions
|
||||||
|
|
||||||
@ -105,8 +105,14 @@ export class ClientUniverse {
|
|||||||
const socketFunctionUnsubscribe = new plugins.smartsocket.SocketFunction({
|
const socketFunctionUnsubscribe = new plugins.smartsocket.SocketFunction({
|
||||||
funcName: 'unsubscribe',
|
funcName: 'unsubscribe',
|
||||||
allowedRoles: [],
|
allowedRoles: [],
|
||||||
funcDef: async (data: interfaces.IServerUnsubscribeActionPayload) => {
|
funcDef: async (dataArg: interfaces.IServerUnsubscribeActionPayload) => {
|
||||||
throw new Error('TODO');
|
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(
|
const clientUniverseMessage = ClientUniverseMessage.createMessageFromMessageDescriptor(
|
||||||
messageDescriptorArg
|
messageDescriptorArg
|
||||||
);
|
);
|
||||||
this.observableIntake.push(clientUniverseMessage);
|
this.messageRxjsSubject.next(clientUniverseMessage);
|
||||||
|
|
||||||
// lets find the corresponding channel
|
// lets find the corresponding channel
|
||||||
const targetChannel = this.getChannel(clientUniverseMessage.targetChannelName);
|
const targetChannel = this.getChannel(clientUniverseMessage.targetChannelName);
|
||||||
|
@ -63,6 +63,10 @@ export class ClientUniverseChannel implements interfaces.IUniverseChannel {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public unsubscribe() {
|
||||||
|
// TODO: unsubscribe all users
|
||||||
|
}
|
||||||
|
|
||||||
public async populateSubscriptionToServer() {
|
public async populateSubscriptionToServer() {
|
||||||
// lets make sure the channel is connected
|
// lets make sure the channel is connected
|
||||||
if (this.status === 'unsubscribed') {
|
if (this.status === 'unsubscribed') {
|
||||||
|
@ -26,7 +26,7 @@ export class UniverseConnection {
|
|||||||
universeConnection
|
universeConnection
|
||||||
);
|
);
|
||||||
universeRef.universeCache.connectionMap.add(universeConnection);
|
universeRef.universeCache.connectionMap.add(universeConnection);
|
||||||
console.log('hi')
|
console.log('hi');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user