Compare commits

..

6 Commits

Author SHA1 Message Date
da6b7724b8 1.0.78 2019-09-10 10:55:11 +02:00
be7ca29e4b fix(core): update 2019-09-10 10:55:10 +02:00
f401d78c4b 1.0.77 2019-09-10 10:51:18 +02:00
6ceec0201f fix(core): update 2019-09-10 10:51:18 +02:00
16ce4e09a9 1.0.76 2019-09-10 10:50:56 +02:00
2868ab686d fix(core): update 2019-09-10 10:50:55 +02:00
8 changed files with 27 additions and 23 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartuniverse", "name": "@pushrocks/smartuniverse",
"version": "1.0.75", "version": "1.0.78",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartuniverse", "name": "@pushrocks/smartuniverse",
"version": "1.0.75", "version": "1.0.78",
"private": false, "private": false,
"description": "messaging service for your micro services", "description": "messaging service for your micro services",
"main": "dist/index.js", "main": "dist/index.js",

View File

@ -7,7 +7,7 @@ export interface ISocketRequest_SubscribeChannel {
passphrase: string; passphrase: string;
}; };
response: { response: {
subscriptionStatus: 'subscribed' | 'unsubscribed' subscriptionStatus: 'subscribed' | 'unsubscribed';
}; };
} }
@ -15,6 +15,6 @@ export interface ISocketRequest_ProcessMessage {
method: 'processMessage'; method: 'processMessage';
request: interfaces.IUniverseMessage; request: interfaces.IUniverseMessage;
response: { response: {
messageStatus: 'ok' | 'channel not found' messageStatus: 'ok' | 'channel not found';
}; };
} }

View File

@ -4,7 +4,6 @@ export type IServerCallActions =
| 'channelUnsubscribe' | 'channelUnsubscribe'
| 'terminateConnection'; | 'terminateConnection';
export interface IServerUnsubscribeActionPayload { export interface IServerUnsubscribeActionPayload {
name: string; name: string;
} }

View File

@ -56,20 +56,18 @@ export class ClientUniverseChannel implements interfaces.IUniverseChannel {
public async subscribe(observerArg?: plugins.smartrx.rxjs.Observer<any>) { public async subscribe(observerArg?: plugins.smartrx.rxjs.Observer<any>) {
// lets make sure the channel is connected // lets make sure the channel is connected
if (this.status === 'unsubscribed') { if (this.status === 'unsubscribed') {
const response = await this.clientUniverseRef.smartsocketClient.serverCall<interfaces.ISocketRequest_SubscribeChannel>( const response = await this.clientUniverseRef.smartsocketClient.serverCall<
'subscribeChannel', interfaces.ISocketRequest_SubscribeChannel
{ >('subscribeChannel', {
name: this.name, name: this.name,
passphrase: this.passphrase passphrase: this.passphrase
} });
);
this.status = response.subscriptionStatus; this.status = response.subscriptionStatus;
} }
if (observerArg) { if (observerArg) {
return this.subject.subscribe(observerArg); return this.subject.subscribe(observerArg);
} }
} }
public async emitMessageLocally(messageArg: ClientUniverseMessage) { public async emitMessageLocally(messageArg: ClientUniverseMessage) {

View File

@ -1,5 +1,3 @@
import * as plugins from './smartuniverse.plugins'; import * as plugins from './smartuniverse.plugins';
export class ReactionRequest { export class ReactionRequest {}
}

View File

@ -1,3 +1,3 @@
import * as plugins from './smartuniverse.plugins'; import * as plugins from './smartuniverse.plugins';
export class ReactionResponse {} export class ReactionResponse {}

View File

@ -62,6 +62,16 @@ export class Universe {
*/ */
public addChannel(nameArg: string, passphraseArg: string) { public addChannel(nameArg: string, passphraseArg: string) {
const newChannel = UniverseChannel.createChannel(this, nameArg, passphraseArg); const newChannel = UniverseChannel.createChannel(this, nameArg, passphraseArg);
return newChannel;
}
/**
* returns a channel
*/
public getChannelByName(channelNameArg: string) {
return this.universeCache.channelMap.find(channelArg => {
return channelArg.name === channelNameArg;
});
} }
/** /**
@ -95,13 +105,12 @@ export class Universe {
// add the role to smartsocket // add the role to smartsocket
this.smartsocket.addSocketRoles([ClientRole]); this.smartsocket.addSocketRoles([ClientRole]);
const socketFunctionSubscription = new plugins.smartsocket.SocketFunction<interfaces.ISocketRequest_SubscribeChannel>({ const socketFunctionSubscription = new plugins.smartsocket.SocketFunction<
interfaces.ISocketRequest_SubscribeChannel
>({
allowedRoles: [ClientRole], // there is only one client role, Authentication happens on another level allowedRoles: [ClientRole], // there is only one client role, Authentication happens on another level
funcName: 'subscribeChannel', funcName: 'subscribeChannel',
funcDef: async ( funcDef: async (dataArg, socketConnectionArg) => {
dataArg,
socketConnectionArg
) => {
const universeConnection = new UniverseConnection({ const universeConnection = new UniverseConnection({
socketConnection: socketConnectionArg, socketConnection: socketConnectionArg,
authenticationRequests: [dataArg] authenticationRequests: [dataArg]