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
the stability of data transmission and the size of data transmission volume. Websocket.org compared the performance benefits of polling and Websocket:As can be seen, the WebSocket has a great performance advantage, the flow and load increase in the case of more obvious advantages.ExampleBrowser requestGET / HTTP/1.1Upgrade: websocketConnection: UpgradeHost: example.comOrigin: nullSec-WebSocket-Key: sN9cRrP
your data is sent in a "connection", in fact, it will cross the mountains and rivers, after countless times of forwarding, filtering, in order to finally reach the end. In this process, the processing of intermediate nodes is likely to surprise you.For example, the middle nodes of these pits may think that a connection is useless without data sending for a period of time, and they will cut off these connections on their own. In this case, regardless of the server or the client will not receive
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 server log every once in a while? Out, try the web
Most websites use HTTP Communication, while HTTP is a connectionless protocol. Only when the client requests, the server can send a corresponding response, and the HTTP request package is also relatively large. If it is only a small data communication, the overhead is too large. So, we can use websocket this specific websocket introduction visible http://zh.wikipedia.org/wiki/
Project descriptionWebsocket-client module is websocket client for Python. This provide the low level APIs for WebSocket. All APIs is the synchronous functions.Websocket-client supports only hybi-13.License
Lgpl
InstallationThis module was tested on Python 2.7 and
Specific WebSocket introduction Visible Http://zh.wikipedia.org/wiki/WebSocket
Here, we describe how to use Python to communicate with the front-end JS.
WebSocket after the handshake is completed using the HTTP protocol, WebSocket communication is not made directly through
The specific WebSocket introduction is visible Http://zh.wikipedia.org/wiki/WebSocket
Here, how to use Python to communicate with the front-end JS.
WebSocket use the HTTP protocol to complete the handshake, do not direct websocket communication via HTTP.
So, using
Most sites use HTTP protocol communication. HTTP is a non-connected protocol. The server-side talent sends a corresponding response only when the client is requested. the HTTP Request package is also larger, assuming only very small data traffic. Too much overhead. As a result, we are able to use the websocket Protocol to implement connection-oriented communication with minimal overhead. Detailed websocket
Recently in a project to use the HTML5 introduced in the WebSocket technology, I thought it should be easy to handle, who knows in the real development after the discovery of a lot of trouble, although we are a front-end development and design of the team, And as a second-hand program apes have long been not to be seen, but in order to have the same needs of friends to take a few detours, I still decided to put the implementation of the method in this
Recently in a project to do need to use the WebSocket technology introduced in the HTML5, originally thought should be easy to fix, who knows in the real development after the discovery of a lot of trouble, although we are a front-end development and design of the team, And as a second-hand program apes are not to be seen for a long time, but in order to have the same needs of friends less detours, I decided to put the implementation method affixed to
This article mainly introduces a simple WebSocket server that is compatible with the old and new Socket protocols in Python, if you need it, you can refer to the WebSocket technology introduced in HTML5 that needs to be used in a recent project. I thought it would be easy to handle it, who knows that there are a lot of troubles after the development is really sta
The WebSocket technology introduced in HTML5 needs to be used in a project recently, which was supposed to be easily handled, who knows that there are a lot of troubles after the development is really started? Although we are a long-experienced team in development and design, we have never been seen as a second-hand programmer for a long time, however, I decided to stick the implementation method here to reduce detours for my friends who have the same
Python tornado websocket real-time log display, tornadowebsocket
I,Topic: Displays dynamically generated log files on the server in real time.
II,Process:
1. The client browser establishes a websocket link with the server. The server suspends the instance to save the link and waits for the new content to trigger the return action.
2. log server scripts cyclically
Summary of websocket implemented by python -- wspy
Previously, we had a websocket package for php. For more information, see Websocket-php practice. Recently, we used python to perform some functions and needed websocket operation
Prior to the PHP version of the WebSocket package, see websocket--php Combat, the recent use of Python to do some functions, need to use the websocket operation, so, referring to the previous implementation, the implementation of this Python version. SOURCE See Https://githu
server log, can see the remote log is referenced by other frameworks (such as bottle,tornado) to achieve, And all of this is to rewrite the thread's Run method to achieve, because I am too technical, I do not know how to change the way I need to look, and I am using the Django Web framework, do not want to introduce other frameworks, too complicated, So use Python to simply implement the WebSocket server.
1. What is websocket?API
Websocket API is the asynchronous communication method of the Next Generation client-server. This communication replaces a single TCP socket. It uses ws or WSS protocol and can be used for any client or server program. Websocket is currently standardized by W3C. Websocket has been received by
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.