Io response 2 seconds too slow

  node.js, question

1. how to prevent socket.io requests from being caught
2. why is my socket.io request like this: the two requests are post, get, tens of milliseconds and more than a second
3. Senior brothers who have worked in chat rooms can chat privately with remuneration.
4.socket cluster correlation and disconnection reconnection mechanism. After reading many articles, a single multi-node service with ip_hash and nginx load has been temporarily set up. There is no stress test yet. The server configuration is 4stone 8g memory.
5. There are many live apps on the market. php workerman and nodejs socketio are useful in live chat rooms. The technology of various platforms on the market feels similar. The optimization and high concurrency in the front line are relatively strong.图片描述

图片描述

图片描述

图片描述

图片描述

First of all, one problem should be clarified. When it comes to [high concurrency] and typical [C10K] problems. Jump out of the program and look at the problem.

The development language of world NO.1 gives you a 128M memory VPS. should you be slow or slow?
The server configured by world NO.1 gives you an exit bandwidth of 128kbps. should you be slow or slow?

Then answer the question.

1. how to prevent socket.io requests from being caught

No solution, as long as there is a network request can be caught. The only thing you can do is to encrypt the package. New problem, how to prevent decryption. There is no solution. The reverse process of encryption is called decryption. If there is encryption, there must be a decryption algorithm. If you use HTTPS, you can only prevent middlemen but not local users from grabbing packets. If you use the privatization agreement, I’m sorry, but I still can’t because you use itsocket.ioMust it be a web-based application? Is all the encryption operations including the encryption algorithm also disclosed in the web page inside?
Conclusion: As much as possible to increase the cost of catching and decrypting the package, the input of those who catch and try to decrypt the package is greater than the output. Who else will understand you?

2. why my socket.io’s request …..

I don’t know how to write your js. Either the browser you are testing does not support websocket, this is the LONGPOLL mode of socket.io When the browser does not support websocket, consider flash proxy first. if flash is not supported, only longpoll mode (specific noun Baidu) can be used.

4.socket cluster correlation and disconnection reconnection mechanism

Problems at the level of code logic. The simplest front end is a haproxy or nginx reactance. Reverse proxy to many backend. Gateway or other logical processes are in the middle to store the connections of various clients. Delete after disconnection. Sending a message to a client first finds which server the client is connected to and then commands the server to issue data.

5. there are many live apps on the market, and live chat rooms have php workerman and nodejs socketio. ……

Video streaming media is not just a matter of language and technology. There are professional RTMP solutions, and open source solutions are available everywhere. Which one is more stable? Nodejs/php is currently doing barrage and real-time chat. The real nodejs/php is used to process real-time video streaming media data. I’m sorry, I haven’t seen it yet.