git地址:去围观
SockJS模拟 WebSocket :为websocket的实现提供了多套后备方案,当浏览器不支持websocket时,她可以选择不同的方案实现,并且完全与websocket的特性一样的。
下面是官方的一些简介:
SockJS is a browser JavaScript library that provides a WebSocket-like object. SockJS gives you a coherent, cross-browser, Javascript API which creates a low latency, full duplex, cross-domain communication channel between the browser and the web server.
Under the hood SockJS tries to use native WebSockets first. If that fails it can use a variety of browser-specific transport protocols and presents them through WebSocket-like abstractions.
SockJS is intended to work for all modern browsers and in environments which don\'t support the WebSocket protocol -- for example, behind restrictive corporate proxies.
SockJS-client does require a server counterpart:
Philosophy:
Subscribe to SockJS mailing list for discussions and support.
SockJS family:
Work in progress:
SockJS mimics the WebSockets API, but instead of WebSocket there is a SockJS Javascript object.
First, you need to load the SockJS JavaScript library. For example, you can put that in your HTML head:
SockJS-client
Getting Started