发送大数据.getJSON还是代理?
嘿伙计们。有人告诉我,将数据发送到外部服务器(即 x 域)的唯一技巧是使用 getJSON。我的问题是我发送的数据超出了 getJSON 数据限制。我正在跟踪屏幕上的鼠标移动以进行分析。
另一种选择是我也可以一次发送一些数据。可能每次鼠标移动时。但这似乎会减慢速度。
我可以设置代理服务器。
我的问题是哪个更好?设置代理服务器?或者只是通过 javascript 或 JQUERY 发送一些信息。专业人士使用什么(Google 和其他公司构建的混搭程序,将大量数据发送到 x 域站点)。
我需要了解最佳实践。谢谢!!
数据也被放入 JSON 中。
Hey guys. I was told that the only trick to sending data to a external server (i.e x-domain) is to use getJSON. Well my problem is that the data I am sending exceeds the getJSON data limit. I am tracking mouse movements on a screen for analytics.
Another option is I could also send a little data at a time. probably every time the mouse moves. but that seems as if it would slow things down.
I could setup a proxy server.
My question is which would be better? Setting up a proxy server ? or Just sending bits of information via javascript or JQUERY. What do the professionals use (Google and other company's that build mash-ups that send a lot of data to x-domain sites.)
I need to know the best practices. Thanx!!
Also the data is put into JSON.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
就像一般网络应用程序一样,最佳实践是设置一定的缓冲区大小并将事件写入该缓冲区。达到缓冲区限制后,将其与新的空缓冲区交换以接收事件并通过线路发送完整缓冲区。
Best practice just as a general networking application would be to set a certain buffer size and write your events into that buffer. Once the buffer limit has been reached swap it with a new empty buffer to receive events and send the full buffer out over the wire.
看看这个: http://docs.jquery.com/Ajax/jQuery.post< /a>
使用
get
方法取决于 url 的长度,因为它将?name=value&name2=value2&...
附加到 url。相反,您需要使用post
方法。Take a look at this: http://docs.jquery.com/Ajax/jQuery.post
Using the
get
method is dependant on the length of the url, as it appends a?name=value&name2=value2&...
to the url. Instead, you need to use thepost
method.