Peer-To-Peer chat iOS Application - ios

Is it possible to create a chat application that works with Peer-To-Peer, so without a server connecting the devices?
I think this would be more trustworthy for users...

Yes it is possible, but you will still need some type of server or middleman that everyone connects to at first in order to find the people to chat and distribute their ips to each client, but from that point onward you can use tcp to connect the devices without a middleman.

Related

Unable to establish websocket connection when using Apple devices

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!

How to identify IoT devices on WiFi network in Rails production app?

I have an IoT project that I have been developing using Rails. I am using ActionCable to manage websocket connections between my app and Arduino devices. The Arduino's are hardwired to ping into the app and join the websocket channel. In development, it is easy because I tell my server to listen to outside requests and the Arduinos ping localhost:3000. Now that I am trying to deploy, I realized it's tricky to manage this in production.
I would like a user to log in and see a list of smart devices in their home, the same way that many market ready devices work. If my app is on Heroku, is there a way I can configure the Rails app to look for incoming requests that share the same WiFi network as the current user? Otherwise, I would need to set up a form on the Arduinos where users would have to input their login credentials for the app to associate devices to users, but from a user experience perspective that would be a pain.
I would probably try to generate and hardcode a unique token in each arduino, put it on a sticker on the device and then ask the users to register their devices.
Or if there is way for them to input the wifi passwords for the local wifi, then you can do any kind of device identification when you show some secret on the website and ask the user to enter it on the device(s).

Peer to Peer Communication without Server in iPhone

Is there any way to communicate between two devices or application with Browser of other devices without having Server in the middle?
If I explain, actually I want to share data between iPhone application and Browser of Desktop, I tried HTTPServer, & played with WebSocket too, but in these case this server plays an important role in between. So If somehow I exchange data between two peers like IP Address, Port number, Then Is it possible to communicate between those two devices using Wi-fi channel without having Server in Middle?
The Way, Right now I have implemented.
The way, I am looking for.
I recently came across http://www.freedomjs.org/ which is suppose to provide p2p functionality in the browser.

Not able to view active servers through wifi and connect with it all the time by using Bonjour and NSNetServiceBrowserDelegate?

i am working on an App that uses wifi network to pass data from one ipad to another ipads .
i have already referred the following sample code about:
http://mobileorchard.com/tutorial-networking-and-bonjour-on-ip
The above sample code connects Devices using wifi and can exchange messages using Cfnetworking and Bonjour.
My problem is that i am not able to see Active Servers all the time .While Some times it Shows me Active servers and i can easily connect with and Exchange Messages but when i relaunch or open the app after some time it doesn't show me active servers so i am unable to connect and exchange messages. The same problem occurs in the sample code available from above link having tutorial on to Send data over wifi to another Devices.
I am Stucked up over here where i am unable to connect with active Devices all the time because not able to access those servers.
In chatty sample code same problem occurs where you can see active chat room's and connect with but some times you will not be able to see those active chat rooms availabe even if there are active servers who have already started new chat room where all Devices are connected to same wifi network.
Any help would be highly Appreciable , Thanks in advance.
Any chance the wi-fi interface on the device is going to sleep from disuse? Or that the user roamed to a different Wi-Fi access point with the same name that isn't bridged via Bonjour?
Have you considered using Multipeer Connectivity instead of using Bonjour directly? IIRC, that API would let you communicate even if the devices are not on the same Wi-Fi network, which is probably what you want anyway.

Connect more than 3 ios devices with each other

I want to connect 3 iOS devices with each other.
For example, One iOS device will be like a server, and other 2 device will connect like client, to that server.
To make iOS Device, as server, i am using CocoaHTTPServer,
There is no any internet connection, should use only wi - fi
connection.
Any suggestion ?
I suggest you to use bonjour protocol which is used in ichat..this helps to deal with your problem..
These links may help you..
http://en.wikipedia.org/wiki/Bonjour_%28software%29
http://en.wikipedia.org/wiki/Apple_Filing_Protocol
ok, i solved this problem.
What i have:
(1) one wi-fi router
(2) two iOS devises.
Create local wi-fi network,
Connect 2 devises.
one of the devise will be server, by using this open source library CocoaHTTPServer.
example:
https://github.com/robbiehanson/CocoaHTTPServer/tree/master/Samples/iPhoneHTTPServer
in the iPhone(which is server) you should find the ip, that given by wi fi network, like 192.168.0.101
And uala, go to the iphone browser(which is not server)
and write url:192.168.0.101:9999 number

Resources