What does SSE stand for in HTML?
A
Server-Side Execution B
Secure Socket Extension C
Server-Sent Events D
Standard Stream Events
Analysis & Theory
SSE stands for Server-Sent Events, which allow servers to push updates to the browser.
Which JavaScript object is used to receive server-sent events?
A
ServerEvent B
SSEConnection C
EventEmitter D
EventSource
Analysis & Theory
`EventSource` is the JavaScript interface used to receive SSE updates from a server.
What is the MIME type for an SSE response?
A
application/json B
application/octet-stream C
text/event-stream D
text/sse
Analysis & Theory
`text/event-stream` is the correct MIME type for SSE data streams.
Which method is used to listen for messages from an SSE server?
A
source.listen() B
source.onmessage C
source.getData() D
source.receive()
Analysis & Theory
Use `source.onmessage` to handle messages from the SSE server.
What protocol is used to deliver Server-Sent Events?
A
WebSocket B
HTTP C
FTP D
SSH
Analysis & Theory
SSE uses standard HTTP for delivering real-time updates.
How does the server send a message to the client in SSE format?
A
data: message\n\n B
event: message C
stream: message D
push: message
Analysis & Theory
Each message must begin with `data:` and end with a double newline (`\n\n`).
How can you close an SSE connection from the client side?
A
source.close() B
source.stop() C
source.disconnect() D
source.terminate()
Analysis & Theory
Call `source.close()` to terminate the SSE connection from the client.
What event is fired when the connection to the server is lost in SSE?
A
onerror B
ondisconnect C
onfail D
onlost
Analysis & Theory
`onerror` is triggered when the browser loses connection to the SSE server.
Can SSE connections automatically reconnect?
A
No, they require manual reconnection B
Yes, by default they retry automatically C
Only in Firefox D
Only if HTTPS is used
Analysis & Theory
SSE connections automatically attempt to reconnect when interrupted.
Which of the following is a major difference between WebSocket and SSE?
A
WebSocket is one-way; SSE is two-way B
SSE works over FTP C
WebSocket supports two-way communication; SSE is one-way (server to client) D
SSE requires HTTPS; WebSocket does not
Analysis & Theory
SSE is one-way (server to client), while WebSockets support full-duplex (two-way) communication.