Вопрос

I am having problems getting Chromium/Firefox to handshake with my node.js install since they both use the hybi10 protocol now (which node WebSocket apparently doesn't support yet).

Am I right in thinking that doing...

new WebSocket( 'ws://127.0.0.1:8000','draft-ietf-hybi-00' );

... should force the browser to use an older protocol? It doesn't seem to solve my problem

Это было полезно?

Решение

No. The second argument is a sub-protocol and not related to the version of the WebSocket protocol being used by the browser. Each browser implements a single version of the WebSocket protocol. Servers often implement support for multiple protocol versions.

Perhaps the Node 'ws' module might work for you. There is also Socket.IO which is higher level communication library that uses WebSockets if it can but includes fallbacks if the WebSocket transport is not available.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top