fix(core): update

This commit is contained in:
2019-04-11 18:50:43 +02:00
parent 8830b825ac
commit 1a7634e8db
6 changed files with 42 additions and 16 deletions

View File

@ -1 +1,7 @@
export interface IUniverseMessage {}
export interface IUniverseMessage {
messageText: string;
targetChannelName: string;
passphrase: string;
payload?: string | number | any;
payloadStringType?: 'Buffer' | 'string' | 'object';
}

View File

@ -31,11 +31,8 @@ export class ClientUniverse {
this.options = optionsArg;
}
public async sendMessage(messageArg, payloadArg) {
const requestBody: interfaces.IUniverseMessage = {
message: messageArg,
payload: payloadArg
};
public async sendMessage(messageArg: interfaces.IUniverseMessage) {
const requestBody: interfaces.IUniverseMessage = messageArg;
const requestBodyString = JSON.stringify(requestBody);
// TODO: User websocket connection if available
const response = await plugins.smartrequest.postJson(`${this.options.serverAddress}/sendmessage` , {

View File

@ -67,7 +67,7 @@ export class Universe {
/**
* initiates a server
*/
public async initServer(portArg: number | string) {
public async start(portArg: number | string) {
// lets create the base smartexpress server
this.smartexpressServer = new plugins.smartexpress.Server({
cors: true,

View File

@ -1,4 +1,5 @@
import * as plugins from './smartuniverse.plugins';
import * as interfaces from './interfaces';
import { Objectmap } from '@pushrocks/lik';
@ -11,7 +12,7 @@ import { UniverseCache } from './smartuniverse.classes.universecache';
* represents a message within a universe
* acts as a container to save message states like authentication status
*/
export class UniverseMessage {
export class UniverseMessage implements interfaces.IUniverseMessage {
/**
* public and unique id
* numeric ascending