mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
27 lines
467 B
TypeScript
27 lines
467 B
TypeScript
import { BaseRpcContext } from './base-rpc.context';
|
|
|
|
type MqttContextArgs = [string, Record<string, any>];
|
|
|
|
/**
|
|
* @publicApi
|
|
*/
|
|
export class MqttContext extends BaseRpcContext<MqttContextArgs> {
|
|
constructor(args: MqttContextArgs) {
|
|
super(args);
|
|
}
|
|
|
|
/**
|
|
* Returns the name of the topic.
|
|
*/
|
|
getTopic() {
|
|
return this.args[0];
|
|
}
|
|
|
|
/**
|
|
* Returns the reference to the original MQTT packet.
|
|
*/
|
|
getPacket() {
|
|
return this.args[1];
|
|
}
|
|
}
|