fix(core): update
This commit is contained in:
@ -1 +1,7 @@
|
||||
export interface IUniverseMessage {}
|
||||
export interface IUniverseMessage {
|
||||
messageText: string;
|
||||
targetChannelName: string;
|
||||
passphrase: string;
|
||||
payload?: string | number | any;
|
||||
payloadStringType?: 'Buffer' | 'string' | 'object';
|
||||
}
|
||||
|
@ -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` , {
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user