--- title: WebSockets slug: WebSockets translation_of: Web/API/WebSockets_API ---
WebSocket to zaawansowana technologia, która pozwala na otwarcie interaktywnej sesji komunikacyjnej pomiędzy przeglądarką użytkownika a serwerem. Dzięki temu API możesz wysłać wiadomość do serwera oraz otrzymać od niego odpowiedzi jako zdarzenia, bez konieczności ponownego odpytywania o nie serwera.
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Version -76 support {{obsolete_inline}} | 6 | {{CompatGeckoDesktop("2.0")}} | {{CompatNo}} | 11.00 (disabled) | 5.0.1 |
Protocol version 7 support {{obsolete_inline}} | {{CompatNo}} | {{CompatGeckoDesktop("6.0")}} {{property_prefix("Moz")}} |
{{CompatNo}} | {{CompatNo}} | {{CompatNo}} |
Protocol version 10 support {{obsolete_inline}} | 14 | {{CompatGeckoDesktop("7.0")}} {{property_prefix("Moz")}} |
HTML5 Labs | {{CompatUnknown}} | {{CompatUnknown}} |
Standard - RFC 6455 Support | 16 | {{CompatGeckoDesktop("11.0")}} | 10 | 12.10 | 6.0 |
Usable in Workers | {{CompatVersionUnknown}} | {{CompatGeckoDesktop("37.0")}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Version -76 support {{obsolete_inline}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
Protocol version 7 support {{obsolete_inline}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
Protocol version 8 support (IETF draft 10) {{obsolete_inline}} | {{CompatUnknown}} | {{CompatGeckoMobile("7.0")}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
Standard - RFC 6455 Support | 4.4 | {{CompatGeckoDesktop("11.0")}} | {{CompatUnknown}} | 12.10 | 6.0 |
Usable in Workers | {{CompatVersionUnknown}} | {{CompatGeckoMobile("37.0")}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
WebSockets support in Firefox is continuing to track the evolving WebSocket specification. Firefox 6 implements version 7 of the underlying protocol, while Firefox 7 implements version 8 (as specified by IETF draft 10). Firefox mobile received WebSocket support in Firefox mobile 7.0.
Prior to Gecko 6.0 {{geckoRelease("6.0")}}, there was, incorrectly, a WebSocket
object that some sites were thinking implied that WebSocket
services were not prefixed; this object has been renamed to MozWebSocket
.
Począwszy od Gecko 7.0 {{geckoRelease("7.0")}}, właściwość network.websocket.max-connections
jest używana by decydować o maksymalnej liczbie połączeń WebSocket, które mogą być otwarte jednocześnie. Domyślnie jest to 200.
Starting in Gecko 8.0 {{geckoRelease("8.0")}}, the deflate-stream extension to the WebSocket protocol has been disabled, since it's been deprecated from the specification drafts. This resolves incompatibilities with some sites.
Prior to Gecko 11.0, both incoming and outgoing messages were limited to 16 MB in size. They may now be up to 2 GB in size. Note, however, that memory limitations (especially on mobile devices) make that a theoretical maximum, not a practical one. In reality, transfers of that size will fail on devices that don't have enough memory.
Additionally, ArrayBuffer send and receive support for binary data has been implemented.
Starting in Gecko 11.0, the WebSocket API is no longer prefixed.