Path and other issues using node.JS and Socket.IO

I am using node.JS in VirtualBox on TurnkeyLinux hosted by Windows. I followed the instructions here . node.JS lives in / root / node. Although I can run simple examples successfully, it’s hard for me to identify some things because I am not an ordinary Linux guy. I wanted to use socket.io.

  • I managed to install node.JS myself using git and tried this with Express and Socket.IO. (e.g. git clone git: //github.com/LearnBoost/Socket.IO.git). It seems to work, but I can't find anything anywhere! Was in / root / node when calling git, waiting for changes in the lib folder ...

  • node.JS uses the CommonJS module system. In the example, Socket.IO is io = require('../')used to import Socket.IO, which looks rather strange to me. Other examples on the Internet relate to "./Socket.IO- node". Since the module is only a JS file after certain rules, I would expect sth as the path to such a file, since I found http.js in / root / node / lib. By the way, looking at the server.js example: Is there a specific reason using var for http, but not for the rest of the variables (url, fs, io, sys)?

  • On the client side of the first line to "How to use" Socket.IO: io.setPath(...). setPath is not mentioned anywhere on the page. Where should he indicate that?

  • I did not find information about stopping / restarting the node using the shell. Perhaps it is so obvious that he was never mentioned anywhere;)

Thanks for the help.

+3
source share
1 answer
  • The git version that ships with the turnkey kernel these days is deprecated. Perhaps this is causing problems. I worked using git on windows and WinSCP;)

  • , index.js , index.html -. "../" index.js , socket.io. Guillermo Rauch index.js socket.io, . /lib/socket.io/. , sth, :./socket.io/socket.io.js, socket.io.js .
    , var . . , ;)

  • . setPath , socket.io.js lib-, html . -.

  • , . PID usind 'ps ux', "" , PID. . , autorestart.

0

Source: https://habr.com/ru/post/1758699/


All Articles