Socket.io response 2 seconds is too slow.

Source: Internet
Author: User
Tags live chat

1. How to prevent Socket.io request from being caught
2. Why my Socket.io request is such a two request one is a post, a get, a dozens of MS, a second more
3. Have a chat room senior can private chat, with remuneration
4.socket cluster correlation and disconnection mechanism, read a lot of articles temporarily get a single multi-node with Ip_hash, Nginx load service, there is no stress test, server configuration is 4 core 8g memory.
5. There are many live apps on the market, live chat rooms useful php Workerman also have Nodejs Socketio, the market on the platform of the technology feel the same, the first-line optimization and high concurrency to do more powerful.

Reply content:

1. How to prevent Socket.io request from being caught
2. Why my Socket.io request is such a two request one is a post, a get, a dozens of MS, a second more
3. Have a chat room senior can private chat, with remuneration
4.socket cluster correlation and disconnection mechanism, read a lot of articles temporarily get a single multi-node with Ip_hash, Nginx load service, there is no stress test, server configuration is 4 core 8g memory.
5. There are many live apps on the market, live chat rooms useful php Workerman also have Nodejs Socketio, the market on the platform of the technology feel the same, the first-line optimization and high concurrency to do more powerful.

The first thing to be clear is a question. When it comes to "high concurrency" and the typical "c10k" problem. Jump out of the program to see the problem.

The world's most developed language, to give you a 128M of memory vps You should slow or slow.
The world's most configured server, give you 128kbps of export bandwidth, you should be slow or slow.

Then answer the question.

1. How to prevent Socket.io request from being caught

No solution, as long as there is a network request can be caught packet. The only thing you can do is to encrypt the package. New issue, how to prevent decryption. No solution, the reverse process of encryption is called decryption, there is encryption is bound to decrypt the algorithm, if you use HTTPS can only prevent the middleman, does not prevent local users to grab the package. Another one, if you use the privatisation agreement, sorry, or not, because you're using socket.io a Web-based application? All the cryptographic operations include whether the encryption algorithm is also exposed in the Web page?
结论:尽可能的增加抓包、解密的成本让抓包、尝试解密者投入大于产出。谁还会去解你。

2. Why my Socket.io request .....

Don't know how to write your JS. Or you test the browser does not support WebSocket, you This is the Socket.io longpoll mode. Browser does not support WebSocket scenario first consider the Flash agent, does not support Flash can only use Longpoll mode (specific terms Baidu)

4.socket cluster-related and wire-break re-connect mechanism

The problem at the logic level of the code. The simplest front end is a haproxy or nginx anti. Anti-generational to more than one backend. There is a gateway or other logical processing in the middle to save each client's connection. Removed after disconnecting. Send a message to the client first to find out which server the client is connected to and then command server to emit data.

5. There are many live apps on the market, live chat rooms useful php Workerman also have Nodejs socketio ...

Video streaming is not just a matter of language and technology. There is a professional rtmp solution ready-made open source solutions everywhere, which is your stability. Nodejs/php is now doing the bomb screen and live chat. Real real-time video streaming media data with nodejs/php, I ignorant, I have not seen.

  • Related Article

    Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.