What I’m trying to do is create and communicate to an embedded wifi device (much like an arduino board) that doesn’t have any frills at all. It basically accepts a socket and listens for information and responds.
The complete extent is that I’m using PhoneGap in order to make the application cross device compatible.
I had planned to try and make TCP sockets using a javascript plug in of some kind, however all of the plugins i’ve come across require server side scripts (not possible in this case). I can always put a gateway computer between the android and iOS devices, but that seems inefficient if I can just create a browser socket.
So my question is does anyone know of a javascript plugin that can create TCP sockets without server side scripting?
If not, do you think it would be possible for me to create a plug-in for PhoneGap that makes calls to the native SocketHandler Code?
Actually, do they already have a plug-in that would allow you to use the Native TCP Sockets via javascript?
I hope my questions makes sense. Basically looking for a way to send small serial communications via TCP/IP over a web browser on a mobile device.
Anybody know abou this?
There are a few plugins available for PhoneGap networking. Three of them are:
These should give you network-layer sockets that can send TCP requests.
As for WebSockets: WebSockets (hereafter “WS”) are an application-layer protocol, like HTTP or XMPP. You can implement WS using TCP yourself, since WS sits on top of TCP.
If Android’s WebView can send WS requests natively, you should use that instead. WS is nothing more than a protocol that sits on TCP and looks kind of like HTTP. Just use a WebSocket server library like ws2py for Python or ws for Node.js. Only use TCP if you need to connect to an existing service that doesn’t understand or accept WebSockets.