Расскажите, как в целом работает технология WebSocket.
Asked at
AI answer
WebSocket is a protocol for persistent, bidirectional data exchange between a client and a server. First, the client establishes a TCP connection and sends an HTTP request with the Upgrade: websocket and Connection: Upgrade headers. If the server accepts the request, it responds with 101 Switching Protocols, and the connection switches to WebSocket. After that, both sides can independently send messages to each other as frames, without creating a new HTTP request for each message. The connection is closed with a special frame; ping and pong can be used to check availability. ws:// works without TLS, while wss:// runs over TLS.
Also asked at getmatch agency
- Why did you leave your previous job?
- What types of data are there in Python?
- Tell us about your work experience.
- A user uploads a video and selects the desired processing, which he wants to get. The service accepts the video, applies the necessary processing, and outputs the final result. By processing, we can understand, for example, the following: make the video black and white, flip it, speed it up N times, etc. It is important that the user can monitor the progress of the processing. Load: 10,000 videos per minute
- What frameworks have you worked with?
Similar questions
- What is WebSocket and how does it differ from regular HTTP?
- How to open a WebSocket connection?
- What experience do you have with asynchronous web frameworks, and what kinds of tasks have you used asynchronous programming for?
- How is WebSocket handled in Django?
- How does WebSocket differ from a regular socket?