How to connect MQTT protocol with angular 8

1,045 views
Skip to first unread message

Sourav Halder

unread,
Nov 12, 2019, 7:47:57 AM11/12/19
to Angular and AngularJS discussion
How to connect MQTT protocol with angular 8. i want to connect mqtt  broker with my app . Please help me out . 

jaya 1

unread,
Nov 14, 2019, 5:01:37 AM11/14/19
to Angular and AngularJS discussion

I am trying to make an MQTT client to my ionic2/Angular 2 projects using the MQTT.js library. so far I created a provider to my project called mqtt-client and then I included the library typing.

npm install mqtt --save

After that I've added the module to my provider:

import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import 'rxjs/add/operator/map';

import { Client, Packet, connect } from 'mqtt';

@Injectable()
export class MQTTClient {
  constructor(public http: Http,  public packet: Packet, public client:Client ) {
    console.log('Hello MqttClientProvider Provider');


  }

}

Sourav Halder

unread,
Nov 14, 2019, 12:51:44 PM11/14/19
to ang...@googlegroups.com
Thanks for your reply .Please could you provide me a workaround code

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/angular/e45be83e-6be0-4cdf-aa16-0c1054d0d02f%40googlegroups.com.


--
Thanks & Regards,
Sourav Halder 
Reply all
Reply to author
Forward
0 new messages