I created a project https://github.com/Automattic/socket.io/tree/master/examples/chat locally and it works great. However, it would be nice to understand how the socket application works.
In the main script run, one of the modules that are pulled in with the request,
var io = require('../..')(server)
what is needed ('../..')?
thank!
When a directory path is assigned require, it will implicitly search index.jsin that directory.
require
index.js
In this case, this is the equivalent
var socket = require("../../index.js"); var io = socket(server);
, require.
module.require docs .
,
("../..');
File form , SOCKET.IO, , Socket.io.
, - , index.js index.node. , .
Source: https://habr.com/ru/post/1547856/More articles:Restart node.js application from code level - javascriptПонимание взаимодействия привязки данных WPF и конверторов значений - c#Unable to compile after switching from Xcode 6 beta 2 to beta 3 - xcode6Using XMPP, can I send a message without a subscription? - xmppКак установить "безопасный" и "httponly" cookie в "Торнадо"? - pythonWhat does this pattern ^ [% w -.] + $ Mean in Lua? - luaGoogle Analytics file not found. - javascriptAndroidAsync Socket.io ArrayIndexOutOfBoundsException - androidEnum using Django ModelField as a string - anti-pattern? - pythonparseSdkContent failed Could not initialize class android.graphics.Typeface - androidAll Articles