2

I want to run client side of socket.io on my apache server.

I have uploaded the socket.io directory to my web server and tried the simple client connection example from the main site socket.io but its not working. I dont know what do I need to get it work and connect my running server.

I Hope, I have clearly explained my problem.

Thank you.

Vural
  • 8,666
  • 11
  • 40
  • 57
  • Is it possible to install it on apache server? Its not localhost, does the provider need to allow me to run nodejs ? I am really confused – Vural Jul 24 '12 at 01:29
  • I am not so familiar to this sorry, I just know how to run nodejs at localhost – Oscar Jara Jul 24 '12 at 01:32

2 Answers2

3

Copy all the files in socket.io\node_modules\socket.io-client\dist to your apache server for example to the js folder. Then add the socket.io.min.js to your page.

<script src="js/socket.io.min.js" type="text/javascript"></script>
<script type="text/javascript">
    var socket = io.connect('http://localhost:3000');
    socket.on('news', function (data) {
        console.log(data);
    });
</script>
Charlie
  • 1,292
  • 8
  • 7
  • It don't work for me on port 7000. This is client: http://pastebin.com/Ft3w8w73 and this is server: http://pastebin.com/0SGgwHBc – ElSajko Aug 27 '12 at 19:53
1

Copy the distributable .js to your own javascript folder. In my case, I'm ussing xampp:

C:\xampp\htdocs\nodejs\node_modules\socket.io\node_modules\socket.io-client\dist
ssoto
  • 469
  • 5
  • 19