Skip to content

Commit

Permalink
Update index.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Souvikns committed Oct 2, 2023
1 parent ddd88f3 commit acdb3dd
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/adapters/mqtt/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ class MqttAdapter extends Adapter {

private subscribe(channels: string[]) {
channels.forEach((channel) => {
const operation = this.parsedAsyncAPI.channels().get(channel).json().subscribe()
const binding = operation.binding('mqtt')
const binding = this.parsedAsyncAPI.channels().get(channel).bindings().get('mqtt').value()
this.client.subscribe(channel, {
qos: binding?.qos ? binding.qos : 0,
}, (err, granted) => {
Expand Down Expand Up @@ -210,8 +209,7 @@ class MqttAdapter extends Adapter {

_send(message: GleeMessage): Promise<void> {
return new Promise((resolve, reject) => {
const operation = this.parsedAsyncAPI.channels().get(message.channel).json().subscribe()
const binding = operation ? operation.binding('mqtt') : undefined
const binding = this.parsedAsyncAPI.channels().get(message.channel).bindings().get('mqtt').value()
this.client.publish(
message.channel,
message.payload,
Expand Down

0 comments on commit acdb3dd

Please sign in to comment.