Compare commits
14 Commits
master
...
Mqtt_Next_
Author | SHA1 | Date |
---|---|---|
|
916fd43e64 | 1 year ago |
|
7c584175ba | 1 year ago |
|
c10b435fb7 | 1 year ago |
|
850cb6238d | 1 year ago |
|
fafde42b84 | 1 year ago |
|
9f61aaee5e | 1 year ago |
|
57899976f2 | 1 year ago |
|
9b3359761f | 1 year ago |
|
d41deddaba | 1 year ago |
|
a2896ff43e | 1 year ago |
|
77b2d70956 | 2 years ago |
|
6723e88c37 | 2 years ago |
|
dca4f1de1a | 2 years ago |
|
ad2ecbc380 | 2 years ago |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,92 @@
|
||||
// import { Alert } from 'react-native';
|
||||
// import initialize from '../../lib';
|
||||
// import * as Paho from '../../lib/paho-mqtt';
|
||||
|
||||
// initialize();
|
||||
|
||||
// class MqttClient {
|
||||
// client: any;
|
||||
// callbacks: { [key: string]: (payloadString: string) => void };
|
||||
// onSuccessHandler?: () => void;
|
||||
// onConnectionLostHandler?: () => void;
|
||||
// isConnected: boolean;
|
||||
|
||||
// constructor() {
|
||||
// const clientId = 'ReactNativeMqtt';
|
||||
|
||||
// this.client = new Paho.Client('127.0.0.1', 9001, clientId);
|
||||
// this.client.onMessageArrived = this.onMessageArrived.bind(this);
|
||||
// this.callbacks = {};
|
||||
// this.onSuccessHandler = undefined;
|
||||
// this.onConnectionLostHandler = undefined;
|
||||
// this.isConnected = false;
|
||||
// }
|
||||
|
||||
// onConnect = (
|
||||
// onSuccessHandler: () => void,
|
||||
// onConnectionLostHandler: () => void,
|
||||
// ) => {
|
||||
// this.onSuccessHandler = onSuccessHandler;
|
||||
// this.onConnectionLostHandler = onConnectionLostHandler;
|
||||
// this.client.onConnectionLost = () => {
|
||||
// this.isConnected = false;
|
||||
// onConnectionLostHandler();
|
||||
// };
|
||||
|
||||
// this.client.connect({
|
||||
// timeout: 10,
|
||||
// onSuccess: () => {
|
||||
// this.isConnected = true;
|
||||
// onSuccessHandler();
|
||||
// },
|
||||
// useSSL: false,
|
||||
// onFailure: this.onError.bind(this),
|
||||
// reconnect: true,
|
||||
// keepAliveInterval: 20,
|
||||
// cleanSession: true,
|
||||
// });
|
||||
// };
|
||||
|
||||
// onError = ({ errorMessage }: { errorMessage: string }) => {
|
||||
// console.log(errorMessage);
|
||||
// this.isConnected = false;
|
||||
// Alert.alert('Failed', 'Failed to connect to MQTT', [
|
||||
// {
|
||||
// text: 'Cancel',
|
||||
// onPress: () => console.log('Cancel Pressed'),
|
||||
// style: 'cancel',
|
||||
// },
|
||||
// {
|
||||
// text: 'Try Again',
|
||||
// onPress: () =>
|
||||
// this.onConnect(
|
||||
// this.onSuccessHandler!,
|
||||
// this.onConnectionLostHandler!,
|
||||
// ),
|
||||
// },
|
||||
// ]);
|
||||
// };
|
||||
|
||||
// onMessageArrived = (message: Paho.Message) => {
|
||||
// const { payloadString, topic } = message;
|
||||
// console.log('onMessageArrived:', payloadString);
|
||||
// this.callbacks[topic](payloadString);
|
||||
// };
|
||||
|
||||
// onPublish = (topic: string, message: string) => {
|
||||
// this.client.publish(topic, message);
|
||||
// };
|
||||
|
||||
// onSubscribe = (topic: string, callback: (payloadString: string) => void) => {
|
||||
// this.callbacks[topic] = callback;
|
||||
// this.client.subscribe(topic);
|
||||
// };
|
||||
|
||||
// unsubscribe = (topic: string) => {
|
||||
// delete this.callbacks[topic];
|
||||
// this.client.unsubscribe(topic);
|
||||
// };
|
||||
// }
|
||||
|
||||
// let client = new MqttClient();
|
||||
// export { client as MqttClient };
|
@ -0,0 +1,16 @@
|
||||
|
||||
// export default class ChatService {
|
||||
// private readonly mqtt_broker = '127.0.0.1';
|
||||
// private readonly mqtt_port = 9001;
|
||||
// private spotifyRequestHandler = new RequestHandler();
|
||||
// public token: string;
|
||||
|
||||
|
||||
// constructor(token: string) {
|
||||
// this.token = token;
|
||||
// }
|
||||
// public async getMusicById(idMusic: string): Promise<Music| null> {
|
||||
// }
|
||||
|
||||
|
||||
// }
|
@ -1,10 +1,14 @@
|
||||
FROM eclipse-mosquitto
|
||||
|
||||
# Copie de votre configuration Mosquitto personnalisée dans le conteneur
|
||||
# Create a password file and add a user
|
||||
RUN touch /mosquitto/config/pwfile && \
|
||||
mosquitto_passwd -b /mosquitto/config/pwfile user1 123
|
||||
|
||||
# Copy your custom Mosquitto configuration into the container
|
||||
COPY mosquitto.conf /mosquitto/config/mosquitto.conf
|
||||
|
||||
# Exposez le port Mosquitto
|
||||
# Expose the Mosquitto port
|
||||
EXPOSE 1883
|
||||
|
||||
# Démarrer Mosquitto
|
||||
# Start Mosquitto
|
||||
CMD ["/usr/sbin/mosquitto", "-c", "/mosquitto/config/mosquitto.conf"]
|
Loading…
Reference in new issue