News and Events
Pieter Humphrey
September 24, 2013
So, you’ve written a “Hello world!” WebSocket application or perhaps even a chat sample. You’re able to exchange messages even in pre-Servlet 3.1 containers and pre-IE 10 browsers (that don’t yet support WebSocket) thanks to the SockJS protocol and Spring’s support for it. However a message is a blank page that can have any content. Whatever message format you choose, proprietary or standard, both client and server need to understand it as well as distinguish different kinds of messages. You need support for the publish-subscribe pattern central to messaging applications so you can broadcast messages to one or more subscribers. You need to incorporate security, validation, and so on. In short you need to build a real-world application. If you’re used to web applications (and Spring MVC annotated controllers) you are familiar with the foundation that HTTP provides including URLs (nouns), HTTP methods (verbs), headers, parameters, and others. Imagine building an application without HTTP, just a socket. WebSocket gives you this brand new, exciting capability – full duplex, two-way communication – yet you no longer have an application-level protocol. Can an entire application be built around a single Endpoint class processing all messages, assuming a single WebSocket connection between browser and server? Join Rossen Stoyanchev as he demonstrates that, thankfully, the WebSocket protocol has a built-in sub-protocol mechanism.
Europe
Tuesday, October 8 3:00PM GMT Summer Time London, GMT+01:00)
Register https://gopivotal.webex.com/gopivotal/onstage/g.php?t=a&d=667384670
North America
Tuesday, October 8 10:00AM PDT San Francisco, GMT-07:00)
Register https://gopivotal.webex.com/gopivotal/onstage/g.php?t=a&d=660130258
comments powered by Disqus
translate:
翻译:
所以,你写了一个“你好的世界!”WebSocket应用程序,甚至可能是一个聊天示例。由于SockJS协议和Spring对它的支持,您甚至可以在pre-Servlet 3.1容器和pre-IE 10浏览器(还不支持WebSocket)中交换消息。但是,消息是可以包含任何内容的空白页。无论您选择哪种消息格式,专有的还是标准的,客户机和服务器都需要理解它并区分不同类型的消息。您需要对消息传递应用程序中心的发布-订阅模式提供支持,以便可以向一个或多个订阅者广播消息。您需要结合安全性、验证等。简而言之,您需要构建一个真实的应用程序。如果您已经习惯了Web应用程序(和Spring MVC注释的控制器),您就熟悉HTTP提供的基础,包括URL(名词)、HTTP方法(动词)、标头、参数等。想象一下构建一个没有HTTP的应用程序,仅仅是一个套接字。WebSocket为您提供了这种全新的、令人兴奋的功能——全双工、双向通信——但您不再拥有应用程序级协议。假设浏览器和服务器之间只有一个WebSocket连接,那么整个应用程序能否围绕一个处理所有消息的端点类构建?加入Rossen Stoyanchev,因为他演示了,谢天谢地,WebSocket协议有一个内置的子协议机制。
本文探讨了如何使用WebSocket和Spring框架构建实时双向通信应用,包括消息格式、发布订阅模式、安全性及验证等内容。

被折叠的 条评论
为什么被折叠?



