fix(core): update

This commit is contained in:
Philipp Kunz 2019-09-10 10:55:10 +02:00
parent f401d78c4b
commit be7ca29e4b
7 changed files with 16 additions and 22 deletions

View File

@ -49,4 +49,4 @@
"npmextra.json",
"readme.md"
]
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -105,13 +105,12 @@ export class Universe {
// add the role to smartsocket
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
funcName: 'subscribeChannel',
funcDef: async (
dataArg,
socketConnectionArg
) => {
funcDef: async (dataArg, socketConnectionArg) => {
const universeConnection = new UniverseConnection({
socketConnection: socketConnectionArg,
authenticationRequests: [dataArg]