Bird
0
0

Given a Django ASGI application handling HTTP and WebSocket, what happens when a WebSocket connection is initiated?

medium📝 component behavior Q4 of 15
Django - Async Django
Given a Django ASGI application handling HTTP and WebSocket, what happens when a WebSocket connection is initiated?
AThe ASGI application accepts and manages the WebSocket asynchronously
BThe WSGI application handles the WebSocket synchronously
CThe server rejects the WebSocket connection automatically
DThe WebSocket is converted to an HTTP request
Step-by-Step Solution
Solution:
  1. Step 1: Understand ASGI's WebSocket support

    ASGI supports asynchronous protocols like WebSocket and can accept connections.
  2. Step 2: Contrast with WSGI

    WSGI cannot handle WebSocket connections; it only supports HTTP synchronously.
  3. Final Answer:

    The ASGI application accepts and manages the WebSocket asynchronously -> Option A
  4. Quick Check:

    ASGI manages WebSocket async connections [OK]
Quick Trick: ASGI handles WebSocket async, WSGI cannot [OK]
Common Mistakes:
MISTAKES
  • Thinking WSGI can handle WebSockets
  • Assuming WebSocket converts to HTTP automatically
  • Believing server rejects WebSocket by default

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes