I developed a video chatting application using simple peer and socket.io . But when I tried hosting the application the peers could not be connected because of the firewall issue . I am aware that STUN and TURN servers are to be used for this purpose . Is it possible to connect to those servers using simple peer ?
If so how?
Any explanation or reference articles will be helpful
You can add the iceServer configuration like in original webrtc in the simple-peer config like so:
{
initiator: false,
config: { iceServers: [{ urls: 'stun:stun.l.google.com:19302' }, { urls: 'stun:global.stun.twilio.com:3478?transport=udp' }] },
}
You can add stun servers and/or turn servers.
If you read the source code of the simple-peer npm package you will realize that it currently uses
URLs: [
'stun:stun.l.google.com:19302',
'stun:global.stun.twilio.com:3478'
]
for its public IP discovery needs.
Your app fails to work in case of firewall because just stun server is insufficient in case of firewall.
Besides a STUN server, you need a TURN server is this case.
TURN is the fallback is case STUN fails to deliver.
Related
I'm just wondering if there are any means of service discovery built into the nanoframework?
I am mainly interested in mDNS or unicast DNS service discovery. Think Apple Bonjour/Avahi.
I noticed Espressif has some arduino examples around mDNS.
https://github.com/espressif/arduino-esp32/blob/a59eafbc9dfa3ce818c110f996eebf68d755be24/libraries/ESPmDNS/examples/mDNS-SD_Extended/mDNS-SD_Extended.ino
It would make sense as a separate deployment use case when you don't want to connect to a hub in the cloud but instead have the hub (MQTT server) running on the local network and need to discover it.
Many thanks!
Currently there is no support for mDNS in .NET nanoFramework.
But that doesn't seem overcomplicated to add. Please raise an issue with the feature suggestion on our GitHub.
Update 01-01-2023:
Support for mDNS in .NET nanoframework was requested in https://github.com/nanoframework/Home/issues/912. In that discussion, https://github.com/karlredgate/mDNS-sharp was recommended as an alternative to having it built-in into .NET nanoframework. It is not clear whether people succeeded with that, though.
Welcome Cristian!
On an ESP32 you can include multicast DNS and DNS-Service Discovery like that:
#include <ESPmDNS.h>
...
if (MDNS.begin("esp32")) { // access this ESP32 via http://esp32 (eg in browser)
Serial.println("mDNS responder started");
}
...
// register a http-service in DNS-SD
if (mdns_service_add("esp32_website", "_http", "_tcp", 80, NULL, 0)) {
Serial.println("DNS-SD responder started");
}
mdns_service_txt_item_set("esp32_website", "_http._tcp", "version", "1.0");
In order to actually discover the ESP32 and it's services you need to make sure that the machine you are working on supports mDNS and DNS-SD.
Note: mDNS just "resolves" the name of the ESP to it's IP. You need to set-up a webserver on it to actually DO something (like provide the DNS-SD-promised website or such)
I was trying to enable the AMQP 1.0 connection with Ditto running on my local virtual Ubuntu machine following the instruction from the website. So I created the twin on my instance, verified it exists and the following step was to create a connection with the endpoint.
First my question: Is it mandatory to use Hono to create AMQP connection? Cause I would prefer to use simple mosquito client. So I tryed to execute the PUT CURL:
{
"targetActorSelection": "/system/sharding/connection",
"headers": { "aggregate": false },
"piggybackCommand": {
"type": "connectivity.commands:createConnection",
"connection": {}
}
}
to the adress where my instance of eclipse ditto running http://localhost/devops/piggyback/connectivity, but i'm getting 401 Authorization error.
I tryed to put the basic authentication used in the example: devops:devopsPw1!, but it fails as well.
Meanwhile sending the same command to the Ditto sandbox instance working fine. What did I miss in my configuration?
Thanks a lot in advance, Mila
regarding the first question. No it is not mandatory to use Hono to create an AMQP connection. You can establish an AMQP connection to whatever uri you define in your connection.
This leads me to the next point. The JSON you provided in your question is missing the description of the actual connection.
I see that we should clarify this in the documentation more explicitly like we did for the testConnection command.
You could have a look at the connection model to see how to configure the connection.
Regarding your second question (401 response) the problem is that the default devops password is "foobar". You can configure it to a password you like by setting the environment variable DEVOPS_PASSWORD of the gateway container.
I hope I could help you.
I am running a RabbitMQ instance that provides MQTT over websockets via the rabbitmq_web_mqtt plugin.
For legacy reasons, I need to support a non-default WebSocket URL.
I saw in the documentation it is possible to change the port via the { port, 1234 } config, but I could not find any way to change the WebSocket URL. It is currently set to the default path of /ws
Is it possible to change the WebSocket URL without modifying the plugin?
This has been made configurable back September 2018. See already mentioned ticket.
Add line:
# echo 'web_mqtt.ws_path = /mqtt' >> /etc/rabbitmq/rabbitmq.conf
# service rabbitmq-server restart
Now being accessible by (compliant) MQTT Clients. For instance at:
ws://192.168.210.84:15675/mqtt
UPDATE: RabbitMQ now allows configuration of the WebSocket URL. See this answer.
After some research, I found out that the path is not configurable
I'm working to create a video calling web app using WebRTC.
The communication is working fine on same network. But when communicating in different network I'm getting ICE failed error.
Error: ICE failed, see about:webrtc for more details
In about:webrtc I' able to get local and remote SDP's, but ICE State is failed. http://imgur.com/a/nPPDr
Here is the code of my main.js file
Here is the my log file from about:webrtc
P.S: Before posting the question I've checked several posts in SO and in other sites but no one did the trick.
Looking at the log file you provided it looks like you provided a TURN server, but the communication with that TURN server simply times out. So either something like a local firewall is blocking the communication with your TURN server or your TURN server is not working.
In case your local firewall blocks UDP traffic it might help to configure and use TURN TCP additionally to get through the firewall.
your about:webrtc does not show any relay candidates gathered from a TURN server. At the risk of sounding like a broken record: you need a TURN server for the majority of connections between different networks.
MQTT over Websocket protocol
I'm trying to connect IBM Watson IoT service using erlang mqtt websockets on port 443(ssl/tls). But, I was receiving error.
The IBM dos(https://console.ng.bluemix.net/docs/services/IoT/iotplatform_task.html#devices) says that it support websocket connection. There is no mention of the websocket usage(tutorials/guide) except normal tcp connection(which i was successfull at getting conected).
I want a simple step by step doc like the Amazon IoT (http://docs.aws.amazon.com/iot/latest/developerguide/protocols.html) for websocket connectivity as a client application.
I'm figuring about the URL/URI which I think might be improper i.e ws(s)://host:port/path.
Currently, i'm giving it as wss://fybr123mqtt.mybluemix.net
(where fybr123mqtt is my application name).
What is the host, port & path for connecting to IBM Watson IoT through mqtt ?
And how to send other parameters like 'client_id', 'username', 'password', 'authentication token' along with the HOST ?
Also, suggest some erlang websocket client for mqtt and also mention simple steps to access the websocket server. Erlang mqtt client (emqttc) does not support websocket.
The connection process is clearly described here:
console.ng.bluemix.net/docs/services/IoT/devices/mqtt.html
The URL that you mentioned is not correct: wss://fybr123mqtt.mybluemix.net
On Step 2: Connecting your devices to Watson IoT Platform from console.ng.bluemix.net/docs/services/IoT/iotplatform_task.html#devices it says the following:
The following information is required when connecting your device:
URL: org_id.messaging.internetofthings.ibmcloud.com
Where org_id is the ID of your Watson IoT Platform organization.
Port:
1883
8883 (encrypted)
443 (websockets)
Device identifier: d:org_id:device_type:device_id
This combination of parameters uniquely identifies your device.
Username: use-token-auth
This value indicates that you are using token authorization.
Password: Authentication token
This value is the unique token that you defined or that was assigned to your device when you registered it.
The org_id, device_type, device_id and password are provided after you complete Step 1: Registering your device with Watson IoT Platform
Note: The clienID is Device identifier: d:org_id:device_type:device_id
I successfully used mqttfx, eclipse paho, mosquitto and there are a lot of other free mqtt clients that you can use.
Also, there are good tutorials (recipes) that can help you get starter with IBM's client libraries in Java, Pyhton, etc. As examples you can have a look on:
"ibm.com/developerworks/cloud/library/cl-mqtt-bluemix-iot-node-red-app/"
Here is an example for gateway device type with mosquitto
"developer.ibm.com/recipes/tutorials/using-mosquitto-as-a-gateway-for-watson-iot/"
Lets not forget the client nodes from NodeRed, that are very easy to use.
Let me know if you still need help on this.
Thanks,
Daniel
Url: wss://6DigitOrgID.messaging.internetofthings.ibmcloud.com:8883
It works fine using NodeJS. I don't specify a further endpoint.
[BaseClient:connect] Connecting to IoTF with host : wss://6DigitOrgID.messaging.internetofthings.ibmcloud.com:8883
[DeviceClient:connect] DeviceClient Connected
connected
[DeviceClient:publish] Publishing to topic iot-2/evt/myevt/fmt/json with payload {"radiation":1} with QoS 2
This is based off the sample client code with "enforce-ws" : true
I modified that client and tested with 443 also:
[BaseClient:connect] Connecting to IoTF with host : wss://6DigitOrgID.messaging.internetofthings.ibmcloud.com:443
[DeviceClient:connect] DeviceClient Connected
connected
[DeviceClient:publish] Publishing to topic iot-2/evt/myevt/fmt/json with payload {"radiation":1} with QoS 2
I don't know of any samples for erlang.