{"id":48498978,"url":"https://github.com/stackmasteraliza/mqqt-with-docker","last_synced_at":"2026-04-07T13:32:56.835Z","repository":{"id":275949406,"uuid":"927669302","full_name":"stackmasteraliza/mqqt-with-docker","owner":"stackmasteraliza","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-05T13:09:50.000Z","size":697,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-05T13:25:49.329Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stackmasteraliza.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-05T10:47:11.000Z","updated_at":"2025-02-05T13:09:53.000Z","dependencies_parsed_at":"2025-02-05T13:35:52.046Z","dependency_job_id":null,"html_url":"https://github.com/stackmasteraliza/mqqt-with-docker","commit_stats":null,"previous_names":["stackmasteraliza/mqqt-with-docker"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stackmasteraliza/mqqt-with-docker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackmasteraliza%2Fmqqt-with-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackmasteraliza%2Fmqqt-with-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackmasteraliza%2Fmqqt-with-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackmasteraliza%2Fmqqt-with-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stackmasteraliza","download_url":"https://codeload.github.com/stackmasteraliza/mqqt-with-docker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackmasteraliza%2Fmqqt-with-docker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31515145,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-07T13:32:56.124Z","updated_at":"2026-04-07T13:32:56.830Z","avatar_url":"https://github.com/stackmasteraliza.png","language":"JavaScript","readme":"# React Native MQTT with Docker\n\nThis project demonstrates how to integrate MQTT with a React Native app using Docker.\n\n## Prerequisites\n\nEnsure you have the following installed:\n- [Docker](https://www.docker.com/get-started)\n- [Node.js](https://nodejs.org/)\n- [React Native CLI](https://reactnative.dev/docs/environment-setup)\n\n## Setting Up MQTT Broker with Docker\n\n1. Pull the Mosquitto MQTT broker image:\n   ```sh\n   docker pull eclipse-mosquitto\n   ```\n\n2. Create a configuration file for Mosquitto:\n   ```sh\n   mkdir mosquitto\n   cd mosquitto\n   echo \"listener 1883\n   allow_anonymous true\" \u003e mosquitto.conf\n   ```\n\n3. Run the Mosquitto MQTT broker in a Docker container:\n   ```sh\n   docker run -d --name mosquitto -p 1883:1883 -v $(pwd)/mosquitto.conf:/mosquitto/config/mosquitto.conf eclipse-mosquitto\n   ```\n\n## Setting Up React Native with MQTT\n\n1. Create a new React Native project (if not already created):\n   ```sh\n   npx react-native init MqttApp\n   cd MqttApp\n   ```\n\n2. Install the MQTT library:\n   ```sh\n   npm install precompiled-mqtt\n   ```\n\n3. Implement MQTT in your React Native app:\n\n   ```javascript\n   import React, { useEffect, useState } from 'react';\n   import { View, Text } from 'react-native';\n   import mqtt from 'precompiled-mqtt';\n\n   const MQTT_BROKER = 'mqtt://localhost:1883';\n   const TOPIC = 'test/topic';\n\n   const App = () =\u003e {\n       const [message, setMessage] = useState('');\n       \n       useEffect(() =\u003e {\n           const client = mqtt.connect(MQTT_BROKER);\n           \n           client.on('connect', () =\u003e {\n               console.log('Connected to MQTT Broker');\n               client.subscribe(TOPIC);\n           });\n\n           client.on('message', (topic, payload) =\u003e {\n               setMessage(payload.toString());\n           });\n\n           return () =\u003e client.end();\n       }, []);\n\n       return (\n           \u003cView\u003e\n               \u003cText\u003eMQTT Message: {message}\u003c/Text\u003e\n           \u003c/View\u003e\n       );\n   };\n\n   export default App;\n   ```\n\n## Running the Application\n\n1. Start the MQTT broker (if not already running):\n   ```sh\n   docker start mosquitto\n   ```\n\n2. Run the React Native application:\n   ```sh\n   npx react-native run-android # For Android\n   npx react-native run-ios # For iOS\n   ```\n\n3. Publish a test message to the MQTT broker:\n   ```sh\n   docker exec -it mosquitto mosquitto_pub -h localhost -t test/topic -m \"Hello MQTT\"\n   ```\n\n## Troubleshooting\n\n- If the React Native app cannot connect to the broker, ensure Docker is running and the MQTT broker is accessible.\n- For Android, update `MQTT_BROKER` to `mqtt://10.0.2.2:1883` when using an emulator.\n- For iOS, update `MQTT_BROKER` to `mqtt://localhost:1883` and ensure the iOS simulator has network access.\n\n## License\nThis project is licensed under the MIT License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackmasteraliza%2Fmqqt-with-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstackmasteraliza%2Fmqqt-with-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackmasteraliza%2Fmqqt-with-docker/lists"}