Mastering Node.js by Sandro Pasquali

Mastering Node.js by Sandro Pasquali

Author:Sandro Pasquali
Language: eng
Format: epub, mobi
Tags: COM060180 - COMPUTERS / Web / Web Services and APIs, COM060080 - COMPUTERS / Web / General, COM051260 - COMPUTERS / Programming Languages / JavaScript
Publisher: Packt
Published: 2017-12-28T08:31:38+00:00


The EventSource stream protocol

Once a server has established a client connection, it may now send new messages across this persistent connection at any time. These messages consist of one or more lines of text, demarcated by one or several of the following four fields:

event: This is an event type. Messages sent without this field will trigger the client's general EventSource event handler for any message. If set to a string such as latestscore, the client's message handler will not be called, with handling being delegated to a handler bound using EventSource.addEventListener('latestscore'…).

data: This is the message being sent. This is always of the String type, though it can usefully transport objects passed through JSON.stringify().

id: If set, this value will appear as the lastEventID property of the sent message object. This can be useful for ordering, sorting, and other operations on the client.

retry: The reconnection interval, in milliseconds.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.