mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-31 03:02:04 +08:00
35 lines
684 B
TypeScript
35 lines
684 B
TypeScript
class test {
|
|
constructor(private ngstomp: ngStomp) {
|
|
const connectHeaders = {
|
|
Auth: "user",
|
|
Accept: "lol"
|
|
};
|
|
|
|
ngstomp.connect('/endpoint', connectHeaders)
|
|
// frame = CONNECTED headers
|
|
.then(function(frame) {
|
|
this.subscription = ngstomp.subscribe('/dest', function(payload, headers, res) {
|
|
this.payload = payload;
|
|
}, {
|
|
headers: "are awesome"
|
|
});
|
|
|
|
// Unsubscribe
|
|
this.subscription.unsubscribe();
|
|
|
|
// Send message
|
|
ngstomp.send('/dest', {
|
|
message: 'body'
|
|
}, {
|
|
priority: 9,
|
|
custom: 42 // Custom Headers
|
|
});
|
|
|
|
// Disconnect
|
|
ngstomp.disconnect(() => {});
|
|
});
|
|
}
|
|
}
|
|
|
|
angular.module("app").controller("ngStompTest", test);
|