Skip to content

Commit 717addc

Browse files
Update article.md
1 parent 29217bf commit 717addc

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

5-network/11-websocket/article.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
# WebSocket
22

3-
The `WebSocket` protocol, described in the specification [RFC 6455](http://tools.ietf.org/html/rfc6455) provides a way to exchange data between browser and server via a persistent connection. The data can be passed in both directions as "packets", without breaking the connection and additional HTTP-requests.
3+
Il protocollo `WebSocket`, descritto nelle specifiche [RFC 6455](http://tools.ietf.org/html/rfc6455) fornisce una mezzo di scambio dati tra server e browser utilizzando una connessione persistente. I dati vengono passati in entrambe le direzioni come "pacchetti" (packets), senza la necessità di interrompere la connessione e senza la necessità di creare nuovi headers-HTTP per le richieste.
44

5-
WebSocket is especially great for services that require continuous data exchange, e.g. online games, real-time trading systems and so on.
5+
I WebSocket sono particolarmente adatti per servizi che richiedono scambi continui di dati, come ad esempio giochi online, sistemi di trading in real-time e così via.
66

7-
## A simple example
7+
## Un semplice esempio
88

9-
To open a websocket connection, we need to create `new WebSocket` using the special protocol `ws` in the url:
9+
Per aprire una connessione websocket, dobbiamo creare un `new WebSocket` utilizzando nell'url il protocollo speciale `ws`:
1010

1111
```js
12-
let socket = new WebSocket("*!*ws*/!*://javascript.info");
12+
let socket = new WebSocket("ws://javascript.info");
1313
```
14+
C'è anche il protocollo criptat `wss://`, utilizzato per i websockets HTTPS
1415

15-
There's also encrypted `wss://` protocol. It's like HTTPS for websockets.
1616

17-
```smart header="Always prefer `wss://`"
18-
The `wss://` protocol not only encrypted, but also more reliable.
17+
```smart header="Sceggli sempre `wss://`"
18+
Il procotollo `wss://` non solo è criptato, ma è anche più affidabile.
1919

20-
That's because `ws://` data is not encrypted, visible for any intermediary. Old proxy servers do not know about WebSocket, they may see "strange" headers and abort the connection.
20+
Questo perchè i dati del `ws://` non sono criptati, visibili per qualunque intermediario. Server proxy molto vecchi, che non riconoscono l'implementazione WebSocket, potrebbero notare i suoi headers strani e chiudere la connessione.
2121

22-
On the other hand, `wss://` is WebSocket over TLS, (same as HTTPS is HTTP over TLS), the transport security layer encrypts the data at sender and decrypts at the receiver. So data packets are passed encrypted through proxies. They can't see what's inside and let them through.
22+
Invece, `wss://` è una connessione over TLS (lo stesso di HTTPS che è HTTP over TLS), TLS cripta il dato invio e lo decripta in ricezione. Così i dati passano attraverso i proxy in maniera criptata e non potendone vedere il contenuto lo lasciano passare.
2323
```
2424
2525
Once the socket is created, we should listen to events on it. There are totally 4 events:

0 commit comments

Comments
 (0)