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": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@aspnet/signalr/-/signalr-1.0.2.tgz",
"integrity": "sha512-sXleqUCCbodCOqUA8MjLSvtAgDTvDhEq6j3JyAq/w4RMJhpZ+dXK9+6xEMbzag2hisq5e/8vDC82JYutkcOISQ=="
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@aspnet/signalr/-/signalr-1.0.3.tgz",
"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": {
"version": "2.2.1",
@ -2730,14 +2738,12 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -2752,20 +2758,17 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"core-util-is": {
"version": "1.0.2",
@ -2882,8 +2885,7 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"ini": {
"version": "1.3.5",
@ -2895,7 +2897,6 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -2910,7 +2911,6 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@ -3029,8 +3029,7 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"object-assign": {
"version": "4.1.1",
@ -3042,7 +3041,6 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -3164,7 +3162,6 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^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",
"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": {
"version": "2.8.0",
"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/router": "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",
"angulartics2": "5.0.1",
"core-js": "2.4.1",

View File

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

View File

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