So I recently got a nodeMCU Lua V1, I started it up connected to my WiFi, and loaded the default HTTP server from https://en.wikipedia.org/wiki/NodeMCU#HTTP_server. Excitedly I did a port forward on my ADSL router and asked friends to connect to see my hello world response. My friends that has apple devices (iPhone/iPad) where unable to load the website. Where as friends with android devices or computers had no trouble viewing the site. I tried using my iPad that is on the same WiFi network. It also had this behavior. To find out what is going on, I tried different browsers on the iPad. I did a Wireshark trace and saw the NodeMCU sending the response to the iPad. But the iPad kept showing either connection error, or a you are offline message. Thinking it might be html headers that is missing I changed the response the nodeMCU is sending to:
<!DOCTYPE html><html><body><h1>My First Heading</h1><p>My first paragraph.</p></body></html>
Still the iPad showed the same message.
So my question is why is iOS behaving this way, what is blocking it and making the browser think it has no internet connection? Is the browser on iOS behaving this way, or is the OS doing something odd. What would I need to do in order for an iOS device to see the web page?
Oh man, that Wikipedia article really is awful (also see https://github.com/nodemcu/nodemcu-firmware/issues/832). I've seen this code example many times but never realized where it originated from.
First of all, you shouldn't use the old 0.9.x binaries your NodeMCU module probably come loaded with. They're no longer supported and contain lots of bugs. Build a custom firmware from the dev or master branch. Second, checkout the official documentation on socket:send() to learn how to do that properly.
The actual problem though is conn:send("<h1> Hello, NodeMcu.</h1>") because that message is NOT a valid HTTP response. You need to prefix that with HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n.
Similar questions & answers are here and here.
Related
I have a web application (hobby project) with a chat function that is implemented with Express.js and socket.io.
Everything works fine on PC and on Android phones, but as soon as you connect with an Apple device, there will be problems since it seems that no websocket connection can be established between the server and the Apple device.
After a bit of googling I found this page:
https://socket.io/docs/v4/troubleshooting-connection-issues/?fbclid=IwAR2XeuehqJkkgFoshFKSVN7sz4UUfWkZ0CPYmsWnqXm-0Q17iVC3dRDyEEI#problem-the-socket-is-stuck-in-http-long-polling
I have limited abilities to troubleshoot on the client side since we do not have a Mac but I followed the troubleshooting that they recommend for the server side. When you connect with an Apple device, it seems that the event "upgrade" is never triggered and you therefore have to settle with HTTP Polling instead of web socket, which does not provide a good user experience.
I have got a certificate from Lets Encrypt and am using HTTPS to access the webpage. I have also tried with several different browsers on the Apple devices.
Anyone have an idea why you can not create a web socket connection with Apple devices and what you could do about it?
Feeling a bit lost and would love some help!
So I have brought a NodeMCU and I am just trying to get a basic project to work over wifi. Well this project here:
https://randomnerdtutorials.com/esp8266-web-server-with-arduino-ide
Now I have it all setup and ready to go I uploaded the code to the board and the serial told me Wifi Connected, ip address 192.168.1.12
I navigate to the ip address on either my phone or computer and they both tell me this site cant be reached.
I tried googling the answer to this issue on my own however all that comes up is "make sure the device is on the same network" and that's the only answer that I can find. All my devices are on the same ssid.
after a while of googling I tried flashing it with NODEMCU FIRMWARE PROGRAMER
and it looked like it flashed successfully but it did not make any difference.
then I tried to see if I could use ESPlorer but everytime I try to connect it just keeps saying communication with mcu... and just hangs there.
Can someone please tell me whats going wrong. I've tried to look on the nodeMCU website but there support page just redirects me to here stack overflow.
Thank you
So I worked out that the problem was with the network router for some reason it was stopping my nodeMCU from being viewed on the network. I factory reset the router and evey thing then worked.
I am trying to debug my web based HLS player (with HTML5 tag) and would like to monitor the network request to fetch the segments of the stream. This works fine in all desktop browsers (safari, chrome, firefox), and works with the OSX Safari, as well.
But when I connect to a iOS Safari (Simulator or real iPhone), only the request of the m3u-file shows up in the network monitor, not the requests to the segments of the stream.
Is there a way to monitor those requests on iOS Safari?
The reason I want to do this is trying to avoid automatic loading of segments while the player is paused/stopped. This works fine with hls.js, but I am not sure how iOS Safari handles the preload=none attribute. Although here Apple says that "Safari on iOS never preloads", this does not seem to be true when pausing the player. (see https://developer.apple.com/documentation/webkitjs/htmlmediaelement/1633059-preload, too)
Thanks!
P.S.: I tried to get any information in Apple's forums before, unfortunately without any success (https://discussions.apple.com/message/32027089#32027089).
You can monitor these requests like any other. I recommend Fiddler... It works as a proxy server and can be used to monitor or edit traffic, even with HTTPS. For lower level debugging or cases where you can't use a proxy, use a packet sniffer like Wireshark.
Apologies in advance for the general-ness of the question.
I'm writing a multiple client iOS app for viewing the video feed from a single camera. Can the QX10 api support two (or 3) iPad's discovering/viewing the same QX10 at the same time?
I've been looking QX10 sample code, the camera api docs, StackOverflow, and of course the dev website and haven't seen an answer. I'd just buy the bloody thing to test with, but there are none nearby and I was hoping to avoid having to mail order/return it if it didn't work.
....And we're not locked into HW. If there's a better option, I'm open....
I don't believe it does. For ios, the camera creates a network that the ios connects to. (In ios settings/wireless) Any further attempts to connect to the camera from another device fail. Since the API only works after a network connection is established, I don't see how the API could possibly allow 2 devices could connect at once.
(No extraneous words in this post b/c that will get edited which auto down votes the question.....ahhh internet)
I did not try it, but you could use a computer with nat. For example an openrwt router to open up multiple wifi interfaces, one to connect to the camera, using the 10.0.0.0 network the camera uses and then an other network to connect your clients with NAT.
The question would be when the API would start to get confused.
So depending on what you want, maybe some mapper on that helper-computer could
do some proxying of information.
So in theory with an external box, maybe, but as Oldmicah said, it seems that only
one device can connect at the time (at least my QX100 also behaves like that). :(
i have been working on developing an blackberry application. as per now i want the application to connect to a local server on my network and fetch a file from that machine. i have been using the library given by a named blackberry developer Mr.peter strange....here is the link for the same Http connection through BIS-B
my requirement would be setting up connection to the local server using any transport mode but it should be able to render the text downloaded.
i tried using the demos provided by blackberry samples as it comes with the plugin for eclipse the http demo from those samples shows only trying to setup an http connection string and the networkapidemo sample shows diffrent http codes when the url is entered as desired.i am running all the applications on the simulator. i havent tried running any of my apps on the hardware
may i know why this problem arises of http codes....ill also want to know guidelines about how to set a simple http connection just to download a file(text file) from a local server.
I have tried many forums too. if anybody would have a look at it i would post it here.
Only a simple connection is becoming a headache!
anyways...waiting for replies..
thanx in advance guys :)
It does not matter whether you want to communicate with local or remote server.
1) See the API docs on HttpConnection. There are sample code in there.
2) Unfortunatelly, on BB you should be aware of Network Transports. Check this thread to get all info you need on Network Transports.
UPDATE:
The second point explains an approach that will work on any OS. If you need an OS 5+ only approach, then check the ConnectionFactory API. ConnectionFactory usage sapmles.