Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update article.md #156

Open
wants to merge 1 commit into
base: master
from

Conversation

@pierangelomiceli
Copy link
Contributor

@pierangelomiceli pierangelomiceli commented Jan 4, 2021

Aggiornato articolo.
Translation completed

@javascript-translate-bot javascript-translate-bot requested a review from javascript-tutorial/translate-it Jan 4, 2021
Copy link
Contributor

@mean2me mean2me left a comment

Ci sono svariati errori di battitura e alcune traduzione sono troppo letterali e in italiano risultano poco chiare e poco fluide.


We need to receive a stream of data from server: maybe chat messages or market prices, or whatever. That's what `EventSource` is good at. Also it supports auto-reconnect, something we need to implement manually with `WebSocket`. Besides, it's a plain old HTTP, not a new protocol.
Abbiamo necessità di rivcevere un data stream da un server: forse messaggi di chat o prezzi dei mercati. Quusto è ciò per cui `EventSource` è fatto. Supporta anche l'uto riconessione, qualcosa che dobbiamo invece implementare manualmente nei `WebSocket`. Oltretutto, è un normalissimo HTTP, e non un nuovo protocollo.

This comment has been minimized.

@mean2me

mean2me Jan 5, 2021
Contributor

data stream => flusso di dati

This comment has been minimized.

@mean2me

mean2me Jan 5, 2021
Contributor

Typo: "Quusto" => "Questo"

This comment has been minimized.

@mean2me

mean2me Jan 5, 2021
Contributor

Typo: "Supporta anche l'uto riconnessione"

- A message text goes after `data:`, the space after the colon is optional.
- Messages are delimited with double line breaks `\n\n`.
- To send a line break `\n`, we can immediately send one more `data:` (3rd message above).
- Un messaggio di testo che va dopo `data:`, lo spazio dopo la virgola è opzionale.

This comment has been minimized.

@mean2me

mean2me Jan 5, 2021
Contributor

Un messaggio di testo che va dopo...
Io proporrei: "Un messaggio di testo segue la stringa data: "
Consiglio di non tradurre in modo troppo letterale ma pensare a scrivere come scriveremmo in italiano.

- To send a line break `\n`, we can immediately send one more `data:` (3rd message above).
- Un messaggio di testo che va dopo `data:`, lo spazio dopo la virgola è opzionale.
- I messaggi sono delimitati con un doppio line break `\n\n`.
- Per inviare un line break `\n`, possiamo inviare immediatamente un altro `data:` (il terzo messaggio poco più sopra).

This comment has been minimized.

@mean2me

mean2me Jan 5, 2021
Contributor

"più sopra" non è molto carino da leggere...
Propongo: "il terzo messaggio nell'esempio precedente"


In practice, complex messages are usually sent JSON-encoded. Line-breaks are encoded as `\n` within them, so multiline `data:` messages are not necessary.
In pratica, i messaggi complessi sono solitamente inviati tramite oggetti codificati in JSO. I Line-breaks sono codificati come `\n` tra essi, e in questo modo i messaggi `data:` multiriga non sono necessari

This comment has been minimized.

@mean2me

mean2me Jan 5, 2021
Contributor

"tra di essi" può essere rimosso, si intuisce dal contesto.


```js
let eventSource = new EventSource("/events/subscribe");
eventSource.onmessage = function(event) {
console.log("New message", event.data);
// will log 3 times for the data stream above
//logghera' 3 volte per il data stream poco sopra

This comment has been minimized.

@mean2me

mean2me Jan 5, 2021
Contributor

logghera' => loggherà (parola orribile, ma ho verificato che esiste nel dizionario italiano)


`readyState`
: The current connection state: either `EventSource.CONNECTING (=0)`, `EventSource.OPEN (=1)` or `EventSource.CLOSED (=2)`.
: Lo stato corrente della connessione: uno tra `EventSource.CONNECTING (=0)`, `EventSource.OPEN (=1)` o `EventSource.CLOSED (=2)`.

This comment has been minimized.

@mean2me

mean2me Jan 5, 2021
Contributor

"uno tra" => "può assumere uno dei seguenti valori"


`error`
: In case of an error, including both lost connection (will auto-reconnect) and fatal errors. We can check `readyState` to see if the reconnection is being attempted.
: In caseo di error, inclusi sia la connessione persa (si riconnetterà automaticamente), e errori fatali. Possiamo controllare `readyState` per vedere se è stata tentata la riconnessione.

This comment has been minimized.

@mean2me

mean2me Jan 5, 2021
Contributor

  • Typo: "In caseo..." => "In caso".

  • la virgola dopo la parentesi tonda, prima della congiunzione "e" andrebbe rimossa:

"automaticamente) ed errori fatali... "


The server may set a custom event name in `event:`. Such events should be handled using `addEventListener`, not `on<event>`.
Il server pu&ograve; impostare un evento custom dentro `event:`. Questi eventi andrebbero gestiti usando `addEventListener`, e non `on<event>`.

This comment has been minimized.

@mean2me

mean2me Jan 5, 2021
Contributor

Propongo: "custom" => "personalizzato"

- `id:` -- renews `lastEventId`, sent in `Last-Event-ID` on reconnect.
- `retry:` -- recommends a retry delay for reconnections in ms. There's no way to set it from JavaScript.
- `data:` -- corpo del messaggio, una sequenza di `data` multipli viene intrpretata come un messaggio singolo, con `\n` tra la parti.
- `id:` -- aggiorna il `lastEventId`, inviato dentro `Last-Event-ID` in fase di riconnnessione.

This comment has been minimized.

@mean2me

mean2me Jan 5, 2021
Contributor

  • Typo: "riconnnessione" ( ci sono 3 "n")
  • Typo: "intrpretata" => "interpretata"
- `retry:` -- recommends a retry delay for reconnections in ms. There's no way to set it from JavaScript.
- `data:` -- corpo del messaggio, una sequenza di `data` multipli viene intrpretata come un messaggio singolo, con `\n` tra la parti.
- `id:` -- aggiorna il `lastEventId`, inviato dentro `Last-Event-ID` in fase di riconnnessione.
- `retry:` -- raccomnda una ritardo nel tentativo di riconessione in millisecondi. Non c'&egrave; modo di impostarlo da JavaScript.

This comment has been minimized.

@mean2me

mean2me Jan 5, 2021
Contributor

  • Typo: "raccomnda"
@javascript-translate-bot

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.