1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

message pack protocol for signalr

This commit is contained in:
Kyle Spearrin
2018-08-23 21:43:40 -04:00
parent 2dc77b6143
commit bc198c60d1
4 changed files with 54 additions and 32 deletions

59
package-lock.json generated
View File

@@ -85,9 +85,17 @@
} }
}, },
"@aspnet/signalr": { "@aspnet/signalr": {
"version": "1.0.2", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/@aspnet/signalr/-/signalr-1.0.2.tgz", "resolved": "https://registry.npmjs.org/@aspnet/signalr/-/signalr-1.0.3.tgz",
"integrity": "sha512-sXleqUCCbodCOqUA8MjLSvtAgDTvDhEq6j3JyAq/w4RMJhpZ+dXK9+6xEMbzag2hisq5e/8vDC82JYutkcOISQ==" "integrity": "sha512-8nPSarp4k+oP2M6P7tw2FZMXOMR86wH9GPb/4wiqA18c4Ds88SUmE0pSpnNQPDOoWGMj6y9F2Xz5JyoynCPXWQ=="
},
"@aspnet/signalr-protocol-msgpack": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@aspnet/signalr-protocol-msgpack/-/signalr-protocol-msgpack-1.0.3.tgz",
"integrity": "sha512-R5CRpxXGICi0Tgbd86uA8bC75Rm0y7Yp6oD87INfKxsav/m/xbz33rkGOI1OZIfsc/J6/WU5z0Bqpc2QgYfaJQ==",
"requires": {
"msgpack5": "^4.0.2"
}
}, },
"@types/form-data": { "@types/form-data": {
"version": "2.2.1", "version": "2.2.1",
@@ -2730,14 +2738,12 @@
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@@ -2752,20 +2758,17 @@
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@@ -2882,8 +2885,7 @@
"inherits": { "inherits": {
"version": "2.0.3", "version": "2.0.3",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
@@ -2895,7 +2897,6 @@
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "^1.0.0"
} }
@@ -2910,7 +2911,6 @@
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
@@ -3029,8 +3029,7 @@
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
@@ -3042,7 +3041,6 @@
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@@ -3164,7 +3162,6 @@
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "^1.0.0",
@@ -4821,6 +4818,28 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}, },
"msgpack5": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/msgpack5/-/msgpack5-4.2.0.tgz",
"integrity": "sha512-tQkRlwO4f3/E8Kq5qm6PcVw+J+K4+U/XNqeD9Ebo1qVsrjkcKb2FfmdtuuIslw42CGT+K3ZVKAvKfSPp3QRplQ==",
"requires": {
"bl": "^2.0.0",
"inherits": "^2.0.3",
"readable-stream": "^2.3.6",
"safe-buffer": "^5.1.2"
},
"dependencies": {
"bl": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/bl/-/bl-2.0.1.tgz",
"integrity": "sha512-FrMgLukB9jujvJ92p5TA0hcKIHtInVXXhxD7qgAuV7k0cbPt9USZmOYnhDXH6IsnGeIUglX42TSBV7Gn4q5sbQ==",
"requires": {
"readable-stream": "^2.3.5",
"safe-buffer": "^5.1.1"
}
}
}
},
"nan": { "nan": {
"version": "2.8.0", "version": "2.8.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.8.0.tgz", "resolved": "https://registry.npmjs.org/nan/-/nan-2.8.0.tgz",

View File

@@ -67,7 +67,8 @@
"@angular/platform-browser-dynamic": "5.2.0", "@angular/platform-browser-dynamic": "5.2.0",
"@angular/router": "5.2.0", "@angular/router": "5.2.0",
"@angular/upgrade": "5.2.0", "@angular/upgrade": "5.2.0",
"@aspnet/signalr": "1.0.2", "@aspnet/signalr": "1.0.3",
"@aspnet/signalr-protocol-msgpack": "1.0.3",
"angular2-toaster": "4.0.2", "angular2-toaster": "4.0.2",
"angulartics2": "5.0.1", "angulartics2": "5.0.1",
"core-js": "2.4.1", "core-js": "2.4.1",

View File

@@ -42,11 +42,11 @@ export class SyncCipherNotification {
revisionDate: Date; revisionDate: Date;
constructor(response: any) { constructor(response: any) {
this.id = response.Id; this.id = response.id || response.Id;
this.userId = response.UserId; this.userId = response.userId || response.UserId;
this.organizationId = response.OrganizationId; this.organizationId = response.organizationId || response.OrganizationId;
this.collectionIds = response.CollectionIds; this.collectionIds = response.collectionIds || response.CollectionIds;
this.revisionDate = new Date(response.RevisionDate); this.revisionDate = new Date(response.revisionDate || response.RevisionDate);
} }
} }
@@ -56,9 +56,9 @@ export class SyncFolderNotification {
revisionDate: Date; revisionDate: Date;
constructor(response: any) { constructor(response: any) {
this.id = response.Id; this.id = response.id || response.Id;
this.userId = response.UserId; this.userId = response.userId || response.UserId;
this.revisionDate = new Date(response.RevisionDate); this.revisionDate = new Date(response.revisionDate || response.RevisionDate);
} }
} }
@@ -67,7 +67,7 @@ export class SyncUserNotification {
date: Date; date: Date;
constructor(response: any) { constructor(response: any) {
this.userId = response.UserId; this.userId = response.userId || response.UserId;
this.date = new Date(response.Date); this.date = new Date(response.date || response.Date);
} }
} }

View File

@@ -1,4 +1,5 @@
import * as signalR from '@aspnet/signalr'; import * as signalR from '@aspnet/signalr';
import * as signalRMsgPack from '@aspnet/signalr-protocol-msgpack';
import { NotificationType } from '../enums/notificationType'; import { NotificationType } from '../enums/notificationType';
@@ -54,7 +55,8 @@ export class NotificationsService implements NotificationsServiceAbstraction {
.withUrl(this.url + '/hub', { .withUrl(this.url + '/hub', {
accessTokenFactory: () => this.apiService.getActiveBearerToken(), accessTokenFactory: () => this.apiService.getActiveBearerToken(),
}) })
// .configureLogging(signalR.LogLevel.Information) .withHubProtocol(new signalRMsgPack.MessagePackHubProtocol())
// .configureLogging(signalR.LogLevel.Trace)
.build(); .build();
this.signalrConnection.on('ReceiveMessage', this.signalrConnection.on('ReceiveMessage',