fix(core): update
This commit is contained in:
parent
8c6946ddb6
commit
eaaefddbe3
@ -1,6 +1,7 @@
|
|||||||
// Client classes
|
// Client classes
|
||||||
export * from './smartuniverse.classes.clientuniverse';
|
export * from './smartuniverse.classes.clientuniverse';
|
||||||
export * from './smartuniverse.classes.clientuniversechannel';
|
export * from './smartuniverse.classes.clientuniversechannel';
|
||||||
|
export * from './smartuniverse.classes.clientuniversemessage';
|
||||||
|
|
||||||
// Server classes
|
// Server classes
|
||||||
export * from './smartuniverse.classes.universe';
|
export * from './smartuniverse.classes.universe';
|
||||||
|
@ -7,7 +7,7 @@ import * as url from 'url';
|
|||||||
|
|
||||||
import * as interfaces from './interfaces';
|
import * as interfaces from './interfaces';
|
||||||
|
|
||||||
import { ClientUniverseChannel, UniverseMessage } from './';
|
import { ClientUniverseChannel, ClientUniverseMessage } from './';
|
||||||
import { ClientUniverseCache } from './smartuniverse.classes.clientuniversecache';
|
import { ClientUniverseCache } from './smartuniverse.classes.clientuniversecache';
|
||||||
|
|
||||||
export interface IClientOptions {
|
export interface IClientOptions {
|
||||||
@ -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<UniverseMessage>;
|
public observableIntake: plugins.smartrx.ObservableIntake<ClientUniverseMessage>;
|
||||||
public clientUniverseCache = new ClientUniverseCache();
|
public clientUniverseCache = new ClientUniverseCache();
|
||||||
|
|
||||||
constructor(optionsArg: IClientOptions) {
|
constructor(optionsArg: IClientOptions) {
|
||||||
@ -109,8 +109,9 @@ export class ClientUniverse {
|
|||||||
const socketFunctionProcessMessage = new plugins.smartsocket.SocketFunction({
|
const socketFunctionProcessMessage = new plugins.smartsocket.SocketFunction({
|
||||||
funcName: 'processMessage',
|
funcName: 'processMessage',
|
||||||
allowedRoles: [],
|
allowedRoles: [],
|
||||||
funcDef: async (data: interfaces.IServerUnsubscribeActionPayload) => {
|
funcDef: async (messageDescriptorArg: interfaces.IUniverseMessage) => {
|
||||||
plugins.smartlog.defaultLogger.log('info', 'Got message from server');
|
plugins.smartlog.defaultLogger.log('info', 'Got message from server');
|
||||||
|
this.observableIntake.push(ClientUniverseMessage.createMessageFromMessageDescriptor(messageDescriptorArg));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -6,7 +6,10 @@ export class ClientUniverseMessage implements interfaces.IUniverseMessage {
|
|||||||
// ======
|
// ======
|
||||||
// STATIC
|
// STATIC
|
||||||
// ======
|
// ======
|
||||||
public static createMessageFromPayload(messageDescriptor: interfaces.IUniverseMessage) {}
|
public static createMessageFromMessageDescriptor(messageDescriptor: interfaces.IUniverseMessage) {
|
||||||
|
const clientuniverseMessage = new ClientUniverseMessage(messageDescriptor);
|
||||||
|
return clientuniverseMessage;
|
||||||
|
}
|
||||||
|
|
||||||
// ========
|
// ========
|
||||||
// INSTANCE
|
// INSTANCE
|
||||||
@ -23,11 +26,12 @@ export class ClientUniverseMessage implements interfaces.IUniverseMessage {
|
|||||||
public payloadStringType;
|
public payloadStringType;
|
||||||
public targetChannelName: string;
|
public targetChannelName: string;
|
||||||
|
|
||||||
constructor(messageArg: interfaces.IUniverseMessage, payloadArg) {
|
constructor(messageArg: interfaces.IUniverseMessage) {
|
||||||
for (const key of Object.keys(messageArg)) {
|
for (const key of Object.keys(messageArg)) {
|
||||||
this[key] = messageArg[key];
|
this[key] = messageArg[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getAsJsonForPayload() {}
|
getAsJsonForPayload() {}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user