I need a way to connect to a socket.io server from a universal (or at least ios and android) phonegap application.
In the browser I would serve the html page from the node script which would allow me to access the socket.io client js file, but I can't do that with phonegap as the html must be packaged to run on the phone.
After doing some research it seems that I need to remotely access the socket.io client js but every attempt at this results in an error. Here is the server code (Heavily based on the example code supplied by http://socket.io/get-started/chat/)
var app = require('express')();
var http = require('http').createServer(app);
var io = require('socket.io')(http);
app.get('/', function(req, res){
res.send('Loaded');
});
io.on('connection', function(socket){
console.log("A person connected!");
})
http.listen(8080, function(){
console.log("listening on port 8080...");
});
And here is the client code without the added phonegap scripts and stuff:
<script type="text/javascript" src="socket-io/socket-io.js"></script>
<script type="text/javascript">
var socket = io.connect();
</script>