Home
Sign Up
Sign In
V2EX
›
问与答
在前台实时展示命令行执行过程的一般思路是什么呢?
9
·
Dec 1, 2014
· 3335 views
This topic created in 4360 days ago, the information mentioned may be changed or developed.
想象这个场景,用户在你的网站中输入 ping
google.com
, 前台就会实时展示 ping 的结果,这个一般是怎么实现的呢。
1. 把执行过程写到一个文件里面,不断得读这个文件,然后展示到前台?
2. websocket ?
如果不能用 nodejs ,能实现吗?
前台
ping
实时
4 replies
•
2014-12-02 09:26:37 +08:00
rrfeng
Dec 1, 2014
1
直接把 stdout /stderr 通过 stream 方式丢到 web 里如何?
tftk
Dec 1, 2014
2
通常都是用 2 来实现的吧。
zungmou
Dec 1, 2014
3
std 重定向,输出时输出<script>脚本来控制前台显示。
9
OP
Dec 2, 2014
4
@
rrfeng
我试试先
@
tftk
websocket没研究过,如果实在没其他方法,只能再花时间研究下了
@
zungmou
输出 script 脚本?也是通过stream方式?
另外这种场景应该搜什么关键字呢,谢谢
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Privacy
·
Solana
·
1607 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 27ms ·
UTC 12:58
·
PVG 20:58
·
LAX 04:58
·
JFK 07:58
♥ Do have faith in what you're doing.
❯