客户< - >服务器和通知 [英] Client <-> Server and notifications

查看:61
本文介绍了客户< - >服务器和通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候!

关于扩展通知系统我有几个问题,比如正在加载,请稍候......:

如果启动此操作应该来自服务器端?或者它必须取决于发送请求后经过的时间(在客户端),如果是,我该如何计算它。只需设置默认的平均执行时间,如果实际执行时间超过预定义的平均值,则显示消息?我只需要一个理论,它应该怎么做。





谢谢。

Greetings!
I've a couple questions regarding extending notification system, like a "Loading, please wait...":
If initiation of this action should come from the server side? or it must depends of time elapsed since request was sent (On client side), if so, how can i calculate it. Just set default average execution time, and if actual execution time is more then predefined average, show message? I need just a theory of this, how it should be done.


Thank you.

推荐答案

严格来说,纯客户端 - 服务器模型假设服务器无法发送通知;它是服务器扮演纯粹被动角色的模型:一切都由一个或另一个客户端初始化,服务器只响应请求。经过的时间在这里完全无关紧要。对于许多应用来说,这种模型非常弱,限制和低效;我从不欣赏它,但它几乎占据了主导地位。

对于某些背景,请阅读:

http://en.wikipedia.org/wiki/Pull_technology [ ^ ],

http://en.wikipedia.org/wiki / Push_technology [ ^ ],

http://en.wikipedia.org/wiki/Client%E2%80%93server_model [ ^ ]。



与此同时,还有更高级和实用的模式,例如 publisher-subscriber 和其他。



网络怎么样?不幸的是,它主要是拉技术(对于一些基本的功能,比如体面的网络聊天应用所需的,这是一个很大的障碍),但对于那些可以投资更复杂的人来说,门并没有完全关闭。请阅读上面引用的第二篇文章中的服务器推送。目前,一个名为SignalR的流行框架可以帮助解决这个问题:

http:// en。 wikipedia.org/wiki/SignalR [ ^ ],

http://www.asp.net/signalr [ ^ ]。



另见我过去的答案相关主题:

网站帐户的应用'信息中心' [ ^ ],

套接字编程中的业余问题 [ ^ ],

来自同一端口号的多个客户端 [ ^ ]。



-SA
Strictly speaking, "pure" client-server model assumes that the server cannot send notification; it's a model where the server play purely passive role: everything is initialized by one or another client, and the server only responds to requests. Elapsed time is totally irrelevant here. This model is extremely weak, limiting and inefficient for many applications; I never appreciated it, but it it became almost dominating.
For some background, please read:
http://en.wikipedia.org/wiki/Pull_technology[^],
http://en.wikipedia.org/wiki/Push_technology[^],
http://en.wikipedia.org/wiki/Client%E2%80%93server_model[^].

At the same time, there are way more advanced and useful models, such as publisher-subscriber and other.

How about the Web? Unfortunately, it is primarily pull technology (and for some basic functionality, like the one needed for decent Web chat applications, this is a big obstacle), but the doors are not completely closed, for those who can invest in more complexity. Please read on "server push" in the second article referenced above. These days, one popular framework called SignalR can help to work around the problem:
http://en.wikipedia.org/wiki/SignalR[^],
http://www.asp.net/signalr[^].

See also my past answers on related topics:
Application 'dashboard' for website accounts[^],
an amateur question in socket programming[^],
Multple clients from same port Number[^].

—SA


这篇关于客户< - >服务器和通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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