Web Socket Questions

I have a couple of questions regarding Web Sockets .

Recent nightly versions of Firefox 4.0 support web sockets. Webkit also works (Chrome 4 + Safari 4/5). It is assumed that Internet Explorer 9 will have web sockets at some point according to Microsoft (up to a stable version).

Anyway, my questions are:

  • I am creating a JavaScript admin interface to manage a website. Should I use web sockets for client-server communication instead of XMLHttpRequest if I told you that I need not to care about browser compatibility?

  • Will web sockets lead to faster save, delete, and update calls compared to the usual situation with XMLHttpRequest? Will requests be more instant?

  • I know HTML5 navigator.onlineand window.addEventListener('offline', ...), but with Web Sockets (after losing my connection) can I detect connection problems more accurately and faster? I mean, when I disconnect my Internet connection or block it with a firewall, Firefox still claims to be navigator.online true . With web sockets, it looks like the connection to the server will be lost instantly, so I can more accurately identify connection problems?

  • Can I support server-side web sockets using pure PHP, so the code is portable with other web servers ( no, you need to install any Apache modules or do some other configuration). I would like to distribute the software in several places without asking people to install all kinds of modules in their HTTPD or so.

I would like you to answer as many of these questions as possible. I'm really interested in the answers.

+3
source share
1 answer

JavaScript -. - - XMLHttpRequest, , ?

, WebSockets . WebSockets , . , , WebSockets.

- , XMLHttpRequest? ?

, ( ) - . , , .

- ( ), ?

, , WebSocket . XHR. .

PHP, -.

. WebSockets . PHP apache . , . , ruby ​​, python, java javascript. , , WebSocket .

WebSocket - , . . , .

: WebSockets . , , , , . , , WebSockets , , . -, .

+5

Source: https://habr.com/ru/post/1751179/


All Articles