Node.js Web应用程序浏览器兼容性 [英] Node.js web application browser compatibility

查看:485
本文介绍了Node.js Web应用程序浏览器兼容性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说node.js是构建实时Web应用程序(聊天,直播等等)的理想框架,然后我猜它涉及nodejs和客户端浏览器之间的大量socket io连接。

I heard node.js is an ideal framework for building real time web application (chatting, live feeds etc...), then i guess it involve lot of socket io connection between nodejs and client browser.

在客户端我是否必须使用websocket(html5)才能与node.js通信,如果是这样的话,那么大多数旧版浏览器都不支持HTML5-Websocket 。

in client side do i have to use websocket(html5) in order to communicate with node.js, if that is the case, then most of the older browser won't support HTML5-Websocket.

问题:
是使用node.js构建的实时Web应用程序,仅适用于兼容HTML5的浏览器。 ?

推荐答案

许多nodejs聊天应用程序使用 socket.io

Many nodejs chat applications use socket.io.

对于没有websockets的浏览器,socket.io有一个后备(涉及拉或Flash):

socket.io has a fallback (involving pulling or Flash) for browsers not having websockets :


Socket.IO的目标是在每个浏览器和
移动设备上实现实时应用,模糊了不同的
传输机制之间的差异。它是免费的实时100%JavaScript。

Socket.IO aims to make realtime apps possible in every browser and mobile device, blurring the differences between the different transport mechanisms. It's care-free realtime 100% in JavaScript.

使用socket.io的重点是你真的不在乎,你只是使用它,大多数浏览器将使用websockets,而有些则不会(但它们仍将尽可能好地工作)。

The point of using socket.io is that you don't really care, you just use it and most browsers will use websockets while some won't (but they still will work as well as possible).

这篇关于Node.js Web应用程序浏览器兼容性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆