{Boxarr.Splice(Boxarr.IndexOf(MyClient),1)}}})})Server.Listen(3000);functionSendmsg(Msg,MyClient){Console.Log(' Sendmsg: '+Msg);VarArray=MyClient.Type==1?Boxarr:Clientarr;For(VarI=0;IArray.Length;I++){If(MyClient.Password==Array[I].Password){array[i]. Write (msgconsole. Log (myclient. Name + myclient. Type == 1 ' mobile ' ' master ' + ' send message ... ' ); }; }; }console. Log ( Let us test, using Telnet, using the agreed protocol to log in, Cqut 123456 1,cqut 123456 0,cqut2 123456 1,
in the set-top box set, send it to him.Recent attention to node. JS, isn't that the feature of node NiO?Let's start with refactoring, using the innate advantages of node. js, high concurrency, non-blockingFirst, encapsulate the connection.var myclient = function (Client, username, Password, type){ This.Client = Client; This.username = username; This.Password = P
I hope this article will solve your problem: "I now know some of the basic concepts of node. js, how to set up a static server?" ”Please refer to the first two articles of the blogger:A completely beginner-oriented node. JS GuideThe module System of node. js and some common moduleThe effect of this article (style is no
technology. I wonder if you have any knowledge about the "Reverse Proxy" in network services. One of the functions is to distribute ports. We may wish to use domain names for Route distribution: requests for AA.com domain names are distributed to port 82 of PHP for execution. Requests for BB.com domain names are distributed to port 83 of ASP for execution ;...... And so on. Of course, the port here is only described and used. You can configure it as needed. It is the request received from port
It is not possible to manage remote sites directly through the node command, which does not guarantee the sustainable operation of the site. We use forever to solve this problem, it can be nodejs to apply the way the future daemon, we can also set the Nodejs app to run automatically with the system boot.First, install Forever:NPM Install FOREVER-GDSo the forever is installed, we can run the Forever command directly:Forever--helpforever start app.jsfor
, Json.parse to convert the JSON text to an object varRetval=json.stringify (arr); Resp.end (retval);//Response Object End Response});//Server starts operation listening PortServer.listen ("localhost",function() {Console.log ("Server started operation, listening on port 3000 ...");});Page ANGULARJS Code:DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd ">H
Create a self-signed HTTPS server with node. js
Create your own CA agency
Create a server-side certificate
Create a client certificate
Package the Certificate
Create your own CA agency
Generate a private key for a CA
OpenSSL genrsa-out ca-key.pem-des 1024
Generate CSR from CA private key
Learn node with me High performance Web server developmentCourse Study Address: http://www.xuetuwuyou.com/course/235The course out of self-study, worry-free network: http://www.xuetuwuyou.comThe course mainly teaches the current popular node development, including but not limited to: node basic Environment Development
Original address: http://my.oschina.net/yushulx/blog/309413Catalogue [-]
Installation
Service side
Client
Reference
Installation?
1
npminstallws
Service sideServer.js?
12345678
var WebSocketServer=require(‘ws‘).Server,wss=newWebSocketServer({port:8080});wss.on(‘connection‘,function(ws){ws.on(‘message‘,function(message){console.log(‘received:%s‘,message);});ws.send(‘something‘);
Installation Configuration NginxOriginal connectionInstalling Nodejs1. Download node Latest version: Connection https://nodejs.org/download/release/wget HTTPS://NODEJS.ORG/DOWNLOAD/RELEASE/V9.9.0/NODE-V9.9.0-LINUX-X64.TAR.XZ2. UnzipTAR-XF NODE-V9.9.0-LINUX-X64.TAR.XZ3. CD to Bin directory execute the following command "Use no
Just read a small example in the node. JS document, which is a small example of writing a Web server with node. jsOn the code (*^▽^*)Helloworld.jsUse node. js to write a server Const http=require (' HTTP '); const hostname= ' 127.0.0.1 ' const PORT=3000;CONST
Node. js remotely connects to the MongoDB database server on another host
My MongoDB is installed in linux.
First, add a user
1. First, run the terminal command line on the MongoDB server host and enter
Mongo
2. Enter use admin to access the user management database.
3. db. addUser ("username", "password"); here, the username and password are the username and pas
How do I use node. js NPM after it has been installed http-server globally? I created the inde.html in its installation directory, the browser localhost:8080 can access, then my project needs to be placed in its installation directory? Or do I need to configure something under my project or use a command to start it? I open cmd in my project directory run Http-server
Recent days project on-line, work relatively busy, no time more bo, fortunately today a little time and colleagues asked me a question, just a piece of solutionUsing Vue to write a project is bound to encounter a problem, how to simulate the server to request data, then it will need to use node. js .First, initialize and create a project
Vue Init webpack-simple
Tags: empty directory export LSE index TCO connection from query first stepStarting Github/blog welcome comments to the StarsInstallationFirst assume that you have node. js installed, then create a directory for your app, then install the Express-generator app skeleton$ mkdir node-demo$ npm install express-generator -g //mac需要加sudoExpress-h$ express -h 用法: express [options] [dir] 选项: -h, --help
Tags: nodejsInstall Python (node relies on python2 in many places, and Ubuntu Server 18.04 defaults to no Python2)sudo apt install python
NVM Official Warehouse: HTTPS://GITHUB.COM/CREATIONIX/NVM
Installation
curl-o-https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | Bashsource ~/.bashrccommand-v NVM # The installation succeeds printing NVM;
Version view
NV
Client-clients, commonly referred to as browsers, can request data from the server via the HTTP protocol.
Server -a server-side, generally referred to as the Web servers, can receive client requests and send response data to the client.
Business-service layer, which handles applications through Web servers, such as interacting with databases, logical opera
Json-server makes it extremely easy-to-Setup robust JSON APIs to use for demos and proof of concepts. John walks through the process of using pre-built JSON files for a server and how to generate larger datasets using Lo Dash and Faker.Install:NPM install-g Json-serverCreate A JSON file:{ "people": [ { "id": 0, "name": "John" } ]}Run:Json-
Nodejs is actually a JavaScript execution environment.To create a new file Server.js, enter the following code:var http = require (' http 'var server = Http.createserver (function(req, res) { Res.writehead ($, {' Content-type ': ' Text/plain '}); Res.end (' Hello world\n ');}); Server.listen (1337, ' 127.0.0.1 '); Console.log (' Server running at http://127.0.0.1:1337 ');The console goes to the direct
After you re-modify the JS code, you do not need to restart the service manually. Need to install Supervisor tool instead of manual.Enter the NPM install SUPERVISOR-G command line to install the Supervisor tool automatically in CMD on a networked basisThen start the service without node Xxx.js after using supervisor Xxx.jsAfter modifying JS, you no longer need to restart the node service manually, superviso
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.