I have a tiny test app running on node.js with socket.io installed:
var io = require("socket.io").listen(8080);
io.sockets.on('connection', function (socket) {
console.log("connected");
socket.emit('balls', { ball:42 });
socket.on('daub', function (data) {
console.log(data);
});
});
As you can see, it sends one message, and logs when it receives one.
I know its all working as when I try this test js outside of C2, it works:
<html>
<head>
</head>
<body>
<script src="socket-io/socket.io.js"></script>
<script>
var socket = io.connect('http://localhost:8080');
socket.on('balls', function (data) {
console.log(data);
socket.emit('daub', { my: 'data' });
});
</script>
</body>
</html>
Using the official C2 web sockets plugin, nothing happens.
Using Zacks socket.io plugin: scirra.com/forum/plugin-zack0wack0s-socketio-mod_topic56503.html
Nothing happens.
My capx simply says:
system->On load complete=WebSocket connect to "ws://localhost:8080" (required protocol "").
It never connects to the server. no errors no nothing.
WebSocket->On message is never fired.
WebSocket->On connection error is never fired.
WebSocket->On connection opened is never fired.
The same using the Socket object provided by Zacks plugin, it does nothing. i.e.
system->On load complete=Socket Connect to "ws://localhost" (port 8080 specified in the dialogue) never connects. It also never calls any events, such as On Connect or on error.
They are both just "dead". But I know the server side is working fine.
any ideas?