WebSocket connection from Unity app - android

I'm writing app that connects to a custom websocket server (socket.io) written in NodeJS.
This server also handles requests from a browser and the browser part works flawlessly, connection, disconnection, messages, all great.
The app part works perfect on Android (tested on samsung s7) and iOS (tested on iPhone6 and 7 with iOS11.3)
Problem is that I need to get it working on headsets like Nibiru and PicoVR, which operative systems are derived from Android (they're a VR version of Android), on these systems, the app works fine, but can't connect to the webserver.
Additional info:
Server runs on port 7000
Server also has apache, php and mysql installed
HTTP connection to server works
The URL I use for the socket is: "http://192.168.12.1:7000" (server is local, running on port 7000 bc port 80 is taken by apache)
I'm developing all the apps with Unity3d, version 2017.2.0f3
Plugin used for WebSockets: Socket.IO-Unity

Solved the issue by changing the scripting runtime version from "Stable 3.5" to "Experimental 4.6"

Related

Debugging HTTPS local services from my mobile device (web, api, websocket)

Having a hard time debugging from mobile device my local development web app which connects to a GraphQL node server and another service using web sockets. All three services running on HTTPS to the below ports.
Web Reactjs app: https://localhost:3335
Node server: https://localhost:3334
Web socket server: wss://localhost:4443
From my macOS machine, everything works as expected but when trying to access the reactjs from Chrome Android and using the inspect desktop devtools and USB cable navigating to https://localhost:3335 works but I get the error POST https://localhost:3334/dev/graphql net::ERR_CERT_DATE_INVALID.
My iOS device doesn't even connect to localhost:3335 or 192.168.2.3:3335.
I am open to any tips, tricks, services, and ideas to debug using my local development machine and mobile devices.
I was able to make it work by navigating to all addresses in the mobile browser and accept the risk of a self-signed certificate.
https://localhost:3334/dev/grapqhl -> accept
https://localhost:4443 -> accept
Now https://localhost:3335 will work fine.
Struggling with iPhone debugging due to localhost not binding to the machine IP address (Pending solution, might create another SO question for reference).

How to connect to cakephp server with localhost:port from Android emulator?

I am running the cakephp built in server bin/cake server which works fine for making requests through my laptop's browser: localhost:8765/users/get/1.
Yet when I try through my Android emulator to reach 10.0.2.2:8765/users/get/1 it just returns 10.0.2.2 refused to connect.
If I turn off the cakephp server and use MAMP instead I can successfully reach my local server with 10.0.2.2:8888/ionic-backend/users/get/1. So I know my emulator is setup correctly but does anyone know how to connect using cakephp's server? It would be much more convenient.
I am using a Mac, if that helps.

Debugging asp.net service with Android device and Chrome Dev Tools

I have setup with VS2012, running an ASP.net web service which talks to an SQL database. I also have an android app being developed (using Cordova, so using javascript) which talks to this web service via ajax.
Everything works fine when I run the javascript on a desktop browser, and most most calls to the web service work fine between the app (loaded onto a phone) and the production server (when I upload the server files there). But there is one service call that doesn't work, and it depends data from Cordova plugins so I have to debug it using the phone and I need to see what's happening at the server end in VS2012 instead of on the production server. I have installed Chrome Dev Tools, and set up port forwarding as described here but can't make the connection; every json call results in "net::ERR_CONNECTION_REFUSED" in the Chrome console. I have tried turning off the firewall on the PC (Windows 7) but no effect.
This must be a common requirement and it seems from the Chrome Dev page that it is all straightforward so what am I doing wrong?

Android: Can Android client talk to Java Proxy server?

Situation : An Android client-server application has been developed. Currently the client and the server are 2 emulators running on the same machine.
Problem: The server will remain an emulator. But the client can be an external device. And such devices cannot directly communicate with emulators. So, a Proxy server must be developed (in Java).
Can an Android client (external device) communicate with a Java Proxy server?

unable to connect to https site on via both code and native browser

I have an android application that makes a https connection to a backend. I have successfully added the required certificate (obtained from the backend and converted to bks format) and the app can connect when running on 2.2, 2.3 and 4.0.2 emulators. However on my huawei u8860 (honor) with ics 4.0.3, the app doesn't connect and worst of all it doesn't give any exceptions in the log. On the phone also, I can't point the native browser to the backend but i can using google-chrome for android. I've searched high and low on but found no explanation for this behaviour. any ideas?! Thanks in advance
I suspect the problem is caused by your mobile carrier.
Some of them perform nasty filtering of HTTP requests, based on the User-Agent header (they'll block requests that do not seem to come from a mobile device).
You should try your app on your phone, using a Wifi connection to confirm/infirm this hypothesis.
If it works on Wifi, you should try to change the User-Agent of your HTTP requests, by either setting it to:
A hard-coded Android Chrome or iPhone Safari User-Agent (that you carrier probably does not block)
The User-Agent of your own device's browser that you should get with getUserAgentString()

Categories

Resources