Which of the following is correct Content-Type header that a server side script should send for SSE in HTML5?

Which of the following is correct Content-Type header that a server side script should send for SSE in HTML5? Correct Answer Content-Type: text/event-stream

The correct answer is option 1.

Key Points

A Server-Sent Events (SSE) allow a web page to get updates for a server. To send event streams, use syntax:   Content-type: “Text/event_stream” 

Hence the correct answer is Content-Type: text/event-stream.

Additional Information

Server Side Script for SSE:

           A server-side script sends a Content-type header defining the type text/event-stream as follows.
print "Content-Type: text/event-stream\n\n";

      After setting Content-Type, the server-side script would send an Event: tag followed by event name. The following example would send Server-Time as event name terminated by a new line character.

print "Event: server-time\n";

Final step is to send event data using Data: tag which would be followed by integer of string value terminated by a new line character as follows −

$time = localtime();
print "Data: $time\n";

Related Questions

You are the administrator of a SQL Server 2000 computer. Your company uses the server to store service contract information for its customers. You are also the administrator of an Oracle relational database management system (RDBMS) server. This server is used to store your company's financial information. The financial information is updated frequently throughout the day.You need to create a series of reports that combine the service contract information and the financial information. These reports will be updated several times a day.You want to create these reports on the SQL Server computer by using the minimum amount of disk space. What should you do?