Write your HTML5 websocket server for full-duplex communication based on Unix philosophy

Source: Internet
Author: User

WEBSOCKETD represents the Guardian process of WebSocket

WEBSOCKETD handles the WebSocket connection between the browser and the server, which initiates the server-side application you specify to process the WebSockets and then delivers the message between the browser and the server application.

20 years ago, there was a technique called CGI that did a similar job, but now the technology will be replaced by WebSocket.

Language Independent

As long as your server application can be run from the command line, you can write WebSocket Terminal Services for your server application.

No additional library support is required

Information passing through WEBSOCKETD is actually very simple, and it is simple to read the text from the standard input stdin and write it to the standard output stdout.

To keep you away from the pain of multithreading.

WEBSOCKETD will run your application in a dedicated, independent process based on all incoming websocket connections. This means that each connection is separated by a different process.

Fully consistent with our accepted UNIX philosophy:

"The Unix app you write should do one thing at a time and do it all the way to the extreme." The software you write should work together. The software you write should be able to handle text flow. Because the interfaces you write for UNIX will be global in general. ”

10-Second Tutorial

Below we create a miniature WebSocket server, the thing to do is to increase to 10, each time plus 1 to pause and the current digital output to the standard output.

First write the above code in your preferred language, here I use the Bash scripting language.

Use the websocketd command above to specify the port to listen on and the name of the application written above that needs to communicate with the browser.

Finally, in a Web page of the PC client, write the corresponding JavaScript script to connect the above websocketd listening port via WebSocket.

Done... From here you can see how easy it is to build a websocket server through WEBSOCKETD!

--Finish----------

WEBSOCKETD Official website: http://websocketd.com/

Work/Translator

Knowledge sharing public Number

CSDN

Heaven Zhuhai Branch Rudder

Techgogogo

Http://blog.csdn.net/zhubaitian

Write your HTML5 websocket server for full-duplex communication based on Unix philosophy

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.