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