我是否需要服务器才能使用 HTML5 的 WebSockets? [英] Do I need a server to use HTML5's WebSockets?

查看:21
本文介绍了我是否需要服务器才能使用 HTML5 的 WebSockets?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 WebSockets 时,是否需要编写服务器代码?换句话说,我的客户端应用程序中的 JavaScript 是否需要连接到专门的服务器,或者我现有的 Apache 服务器是否可以支持这一点?

When using WebSockets, will I need to write server code? In other words, will the JavaScript in my client application need to connect to a specialized server, or will my existing Apache server work to support this?

推荐答案

服务器必须支持网络套接字.在 HTTP 中的第一次握手之后,服务器和客户端打开一个套接字连接.服务器必须能够理解并接受此握手.

The server has to support web sockets. After a first handshake in HTTP, the server and the client open a socket connection. The server must be able to understand and accept this handshake.

在我的上一个项目中,我们使用最新的 Jetty 版本非常成功地运行了 Web 套接字连接.

In my last project we run quite successfully web socket connections using the last Jetty version.

27/02/2014:现在我也在使用 XSockets.net 在 .net 下实现 websockets 并且工作起来很迷人,你甚至不需要网络服务器(自托管).ASP.NET 的 WebSocket 实现也很好.

27/02/2014: Now I'm also implementing websockets under .net with XSockets.net and works like a charm, you don't even need a web server (self hosting). The WebSocket implementation of ASP.NET works also quite good.

这篇关于我是否需要服务器才能使用 HTML5 的 WebSockets?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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