Installation under CentOS6.5 environmentCheck if the Epel is installedYum RepolistIf you do not see the Epel in the results, install it via the Yum commandYum Install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpmStart installing node. js After installing the above environmentsudo yum install Nodejs npm--enablerepo=epel2 Installing Websocket-benchUsing NPM to install in a global mannerNPM install-g
:
Public void RequestProcessCenter () {if (HttpContext. isWebSocketRequest) {var currUser = GetCurrUser (); this. _ UserName = currUser. loginName; HttpContext. acceptWebSocketRequest (ProcessTopic);} else {HttpContext. response. write ("request failed ");}}
The url format required by webSocket should be correct.
Error display
200 is returned. Although the request is successful, the result is not what we want.
The request method is indeed
Open-source C # implements WebSocket protocol client and server websocket-sharp component parsing,
I haven't written a blog for a long time (at least I feel I haven't written it for a long time). I can't help it. The landlord is also a person who needs to live. I 've been looking for a job for a long time. (People who urge me to write code all day long hope to un
[This article is original, if reproduced, please indicate the source http://blog.csdn.net/yl02520/article/]
If we want to build a Web server, we will have a lot of options, the market also has a lot of mature products for us to apply, such as open source Apache, after installation only simple configuration (or the default configuration) can work. But if you want to build a websocket
Use webSocket to enable webpage and server communication and websocket Communication
WebSocket protocol is a new HTML5 protocol. It enables full-duplex communication between the browser and the server ). For details, refer to the relevant materials. Here is a simple example
Create a websocket server instance with python, and share the websocket with python.
I. Start
Using python to implement websocket server, you can display the log information of the remote server in real time on the browser.
A web
WebSocket protocol is a new protocol for HTML5.It implements browser-to-server full-duplex communication (Full-duplex). Browsers and servers only need to do a handshake, and then a fast channel is formed between the browser and the server. The data can be transmitted to each other directly between the two. In this WebSocket
cookie under IP is also sent.You can see that the life cycle of cookies is session level, so it is possible to restart the browser and then access the domain name.The first to third question has been explained.However, Sogou browser request inside also contains a cookie, why Sogou can connect the server normally? Sogou High-speed coreUsing Sogou high-speed nuclear test repeatedly, found that:1. Sogou high-
Client is different.
The first step is to obtain the raw data sent by the Client under different protocols. The old version protocol is relatively simple. In fact, it adds '\ x00' to the original data and' \ xFF 'to the end ', therefore, if the Safari Client sends a string 'test', the actual data received by the WebSocket Server is 'x00test \ xff'. Therefore, yo
the add a ' \xff ', so if Safari's client sends a string ' test ', actually websocket The data received by the server is: ' X00test\xff ', so it is only necessary to peel off the two characters.
The trouble is the new version of the protocol data, according to the version of draft, Chrome and Firefox sent the data message consists of the following parts: First,
. The older version of the protocol is simpler, in effect adding a ' \x00′ ' in front of the original data, plus a ' \xff ' at the back, so if Safari's client sends a string ' test ', it actually websocket Server received the data is: ' X00test\xff ', so only need to peel off the two characters on it.
The trouble is that the new version of the protocol data, acc
simple. In fact, it adds '\ x00' to the original data and' \ xFF 'to the end ', therefore, if the Safari Client sends a string 'test', the actual data received by the WebSocket Server is 'x00test \ xff'. Therefore, you only need to remove the first and last two characters.
What is troublesome is the data of the new version protocol. According to the new version
WebSocketStart by creating a new empty folder that is installed with NPM nodejs-websocket :NPM Install Nodejs-websocket New app.js File:varWS = Require ("Nodejs-websocket"); Ws.createserver (function(conn) {Conn.on ("Text", function (str) {Console.log ("Get the message:"+STR); Conn.sendtext ("The server got the messag
First, install the WebSocket sampler1, from the JMeter plug-in Management organ network download:https://jmeter-plugins.org/Put these 6 jar packages in the C:\JMeter\apache-jmeter-3.3\lib\ext directory2. Download from GitHub:Https://github.com/maciejzaleski/JMeter-WebSocketSamplerSimilarly, download the extracted 6 jar packages into the C:\JMeter\apache-jmeter-3.3\lib\ext directory3. Automatic Installation:When the download is complete,JMeter will res
, despite the success of the request, but the result is not what we want.
The request way is also really websocket, the error exists, this is why? Query a lot of information, but did not find a real solution to this problem, perhaps I find the way there is a problem, but the first three pages of Baidu I saw, and did not want the solution. Self-made, did a test, but found effective.
I deployed on the
less detours I here is simple to say:
Linux installation is relatively simple, first install NPM, command (Curl http://npmjs.org/install.sh | SH): After installing NPM, enter your project development directory and then perform NPM install Websocket-server to install Node-websocket-server.
Because NPM cannot be install
, this is obtained in the first request, and all need to add a post processor--and regular expression extractor to the first request.Now I go to Chrome to see the details of the 3rd request, and we can see that the URL of the third request becomes WS, and the parameter transport becomes websocket. And one more frames column. Frames as shown:Now we create a new WebSocket sampler to simulate the socket link.
The test tool I am using is jmeter, version 2.11. This is a green version of my colleague's copy to me. Run as long as you have a Java environment (: apache-jmeter-2.11). Click on the jmeter.bat in the bin directory to run it. This version of me does not support websocket test, so I need to download a plug-in called Jmeterwebsocketsampler-1.0.2-snapshot.jar, this
Function: Use websocket technology to display the log information on remote server in real time on the browser of operation and Maintenance toolIn general, we need to present the information in the deployment process in real time when the OPS tool is deployed, or show the program log to the developer in real time in the browser. Are you still using AJAX to get the serve
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.