Skip to content

Commit

Permalink
added push message
Browse files Browse the repository at this point in the history
  • Loading branch information
En3rGy committed Dec 24, 2023
1 parent 5b95a86 commit 0287d05
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/hs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,25 @@ export class HomeServerConnector {
if (callback) {
callback(value);
}
else {
this.logger.warn("hs.ts | HomeserverConnector | No callback for %s registered", endpoint)
}
}

} else if (type === 'push') {
this.logger.info('hs.ts | HomeserverConnector | Received push message', message);
endpoint = jsonMsg['subscription'].key;
value = jsonMsg['data'].value;

/// return value via callback
const callback = this._listeners.get(endpoint);
if (callback) {
callback(value);
}
else {
this.logger.warn("hs.ts | HomeserverConnector | No callback for %s registered", endpoint)
}
}
} else if( type === 'call') {
const method = jsonMsg['request'].method;
endpoint = jsonMsg['request'].key;
Expand Down

0 comments on commit 0287d05

Please sign in to comment.