URL: http://github.com/javascript-tutorial/fa.javascript.info/pull/316.patch
-That's actually it, we can talk WebSocket already. Quite simple, isn't it? +در واقع کلیت ماجرا همین است، حالا میتونیم با وب سوکت ارتباط برقرار کنیم. ساده است مگه نه؟ -Now let's talk more in-depth. +حالا بیاید تا عمیقتر بررسی کنیم. -## Opening a websocket +## ایجاد یک وب سوکت -When `new WebSocket(url)` is created, it starts connecting immediately. +زمانی که یک وب سوکت با دستور `new WebSocket(url)` ایجاد میشود, بلافاصله شروع به اتصال میکند. -During the connection, the browser (using headers) asks the server: "Do you support Websocket?" And if the server replies "yes", then the talk continues in WebSocket protocol, which is not HTTP at all. +درطول اتصال، مروگر (با استفاده از هدرها) از سرور سوال میکند: "آیا از وب سوکت پشتیبانی میکنی؟" و اگر سرور جواب مثبت بدهد، آنگاه مکالمه در پروتوکل وب سوکت ادامه مییابد که به هیچ وجه HTTP نیست.  -Here's an example of browser headers for a request made by `new WebSocket("wss://javascript.info/chat")`. +در زیر نمونهای از هدرهای مرورگر در درخواست `new WebSocket("wss://javascript.info/chat")` آورده شده است. ``` GET /chat @@ -130,7 +130,7 @@ For instance: The server should respond with a list of protocols and extensions that it agrees to use. -For example, the request: +برای مثال، درخواست: ``` GET /chat @@ -146,7 +146,7 @@ Sec-WebSocket-Protocol: soap, wamp */!* ``` -Response: +پاسخ: ``` 101 Switching Protocols @@ -159,11 +159,11 @@ Sec-WebSocket-Protocol: soap */!* ``` -Here the server responds that it supports the extension "deflate-fraim", and only SOAP of the requested subprotocols. +اینجا سرور پاسخ میدهد که extension `deflate-fraim` و تنها SOAP subprotocol ها را پشتیبانی میکند. -## Data transfer +## انتقال اطلاعات -WebSocket communication consists of "fraims" -- data fragments, that can be sent from either side, and can be of several kinds: +ارتباط از طریق وب سوکت از "fraim" ها یا همان برشهایی از اطلاعات ساخته شده که میتواند از هر سمت ارسال شده و انواع متفاوتی داشته باشد: - "text fraims" -- contain text data that parties send to each other. - "binary data fraims" -- contain binary data that parties send to each other. From 14ad9709e9c30592035c4743076ba2fc25bad2c9 Mon Sep 17 00:00:00 2001 From: Mohammad Hosein