在交互式网络应用程序方面,特别是那些利用网络套子等技术的图书馆,我们如何能够在客户浏览器和服务器之间传输数据结构(如地图、列表、数据集等)?迄今为止我遇到的例子只是传递字符串。
这是否取决于所利用的图书馆,或是否有更一般性的机制?
在交互式网络应用程序方面,特别是那些利用网络套子等技术的图书馆,我们如何能够在客户浏览器和服务器之间传输数据结构(如地图、列表、数据集等)?迄今为止我遇到的例子只是传递字符串。
这是否取决于所利用的图书馆,或是否有更一般性的机制?
你可以发送三件东西在网络上(从客户角度):
如果您有一个复合的 Javascript 数据结构( 地图和阵列的等级), 那么您应该使用 JSON 将数据序列成字符串, 并将其发送到 WebSocket 连接中作为字符串 。
如果您对通过 WebSocket 连接发送二进制字节或文件数据感兴趣, 您仍然可以序列到字符串( 无效带宽), 或者您也可以以 ArrayBuffers 或 Blobs 格式发送数据 。
注 1: 当发送 ArrayBuffer 或 Blob 时, 您的服务器需要支持二进制框架, 在电线上出现二进制 WebSocket 框架 。
注意 2: 当服务器发送二进制框架时, 客户端可以选择返回对象类型。 这是 WebSocket 对象上的二进制类型属性, 可以设置为“ arraybuffer” 或“ blob ” 。
注 3: 如果浏览器只支持旧的 WebSocket Hexie 协议序列(例如iOS Safari), 那么就没有二进制数据, 您只能发送和接收字符串 。
通常的方式是JSON或类似的。
Client has a dating site and would like to have a popup (either a nice javascript overlay or a new browser window popup. we re flexible.) displayed to users when another user is visiting their page. ...
I m implementing Comet using the script tag long polling technique, based on this page. Following on from my previous question, I ve got it all working, except for one annoyance, which only happens in ...
I m implementing Comet using the script tag long polling technique, based on this page. One issue (that I don t think there s a solution for) is the "throbber of doom" - the browser continues to show ...
I am new to this site, so I really hope I will provide all the necessary information regarding my question. I ve been trying to create a "new message arrived notification" using long polling. ...
I would like to know whether there is a way to write a comet server in C#. i have a C# code that generates data periodically, and I want to push these data to a java app. So would like to convert my C#...
I am trying to implement a Comet style (e.g. chat) application using IronPython. While I don t need to scale to twitter like dimensions, it is vital that the response time is lightening fast. All ...
Does anyone know how to enable active instead of passive sockets in a Mochiweb application. Specifically, I am trying to adapt http://www.metabrew.com/article/a-million-user-comet-application-with-...
How can Comet (aka Server Push) be used with Flash programs? What will be needed at server side for the same? Does this require any customised servers or will normal IIS or Apache do? Also is ...