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 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.
How can I get the IP address of an iPhone and access the internal HTTP server?
I want functionality exactly like the CJournal app, to get the backup files in my desktop computer while both it and the iPhone are on the same network, using a dynamically generated link based on the IP address.
This is the screenshot from CJournal app , i made a backup for my contacts list through this app then it generated an url which is clearly shown in the image, in the url 192.168.2.7 is IP address of my iphone in my Wi-Fi network. now please suggest me how to generate this url and how to maintain or access the internal http server through my app
Have you already tried Zeroconf aka Bonjour? This is a DNS Protokol for Service and Device Discovery which is often used in Apple Environments (eg. Airplay) There is also a Windows Framework provided by Apple. On Linux Devices: take a look into Avahi which seems to be the most complete Solution at the Moment. If you need Help on implementation, take a look at the latest WWDC Videos - there have been several Sessions in the last few years.
I develop an enterprise application for iOS and the user should be able to add files from the desktop to the application.
I implemented this using filesharing, which works great.
Now this company wants to get rid of iTunes from their machines (which is quite understandable, iTunes is a very invasive process).
The question is, is it still possible to somehow use filesharing without iTunes? maybe with another application?
Or what other way is there to send files to the app (preferrably without the need of an internet connection)
//edit: must work on windows 7 and must not require to install iTunes (there are some other tools that allow access to the iPad filesystem, but they go through drivers installed by iTunes)
You could exchange data via the local wireless network (a connection to the internet is not required, just the iOS device and the Windows computer need to be on the same network).
One option:
You can then create a simple TCP/IP connection over sockets between an iOS app and a Windows application and exchange the data you want.
However you probably need to implement a suitable simple Windows application to do this.
An other, maybe simpler, solution:
You could start a webserver in your iOS-App and show it's IP on the screen. By entering this IP in a browser on the desktop computer you can access websites on the iOS device, which can make documents available for download or receive uploads.
For how to do this, have a look at this question.
There are a number of ways to achieve this, ranging from trivial to sophisticated.
Your question says that you would prefer to avoid an internet connection. Simple solutions may require it - if you want to abstract the difficult parts, you're going to have to let somebody do the dirty work, and that's probably going to be someone(thing) on the internet. Midrange solutions may require a network but not internet connection. A sophisticated solution could probably be whatever you want - but one thing I would say, is that trying to tap into the USB connector is either going to result in a hacktastic or very complicated solution to implement.
One method would be to integrate a third party framework that basically does what your looking for. Look at the Dropbox development kit, for example - allowing Windows (or any platform) users to drop files on their desktops into a shared dropbox, and this can then be read by an iOS application which includes the iOS drobox API.
Another method would be to setup a simple WebDAV server in your office. Host it on a windows box, or a cheap linux box. Give users desktop's access to the share via whatever protocol you want (eg, Windows File Sharing). Then you'd implement a WebDAV client in your app (eg, WTClient) to pull files.
Finally, you could build your own transmission system. A sophisticated example might involve Bonjour and TCP/IP, a simpler-but-custom solution may involve a simple JSON web service running off a local (or remote) server.
I have suggestion but that will require the Internet. I would suggest you to use the DropBox API in the windows and iPhone both. It's awesome to use and very simple for file sharing.
Now a days everybody have dropbox account and have files in it to share. So that shouldn't cost anything other than a bit of implementation (this learning can also be used in other file sharing applications).
Here are some guidance:
iOS
REST API
You can add apps and documents to USB-connected devices with the Apple Configurator
You may use a simple Ftp server installed on PC, so you can connect to server from Ios and upload/download files from iOS to PC....
http://developer.apple.com/library/ios/#documentation/Networking/Conceptual/CFNetwork/CFFTPTasks/CFFTPTasks.html
All work is done by Pc and your app will use IP (Intranet or Internet) of PC to share all files.
From Ios you can read all files in FTP server and work with them.
I use the FileBrowser app to get access to network shares over WiFi and will allow you to load supported files to the device. The company responsible is creating an API to allow you to do this within your own app: https://twitter.com/#!/Stratospherix/status/193114857271336960
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.