How to create http server in browser using javascript?

独自空忆成欢 提交于 2019-12-11 09:49:22

问题


I am implement html5 player. It is similar to streaming, but it is not strictly streaming.

First I tried. Using Media Source Extensions. But I can not implement seeking. I do not know the byte offset.

So I thought. If you can create an http server in your browser, I can only respond to range requests.

Can I create http server in browser using javascript? It is support mobile/pc browser. It is must support mobile/pc browser.


回答1:


Can I create http server in browser using javascript?

No. Regular browser Javascript cannot create a web server. Browser Javascript was not given that capability and since you cannot create your own TCP server either, you cannot even build your own http server.

To do something like that, you'd have to have a browser extension that used some native code to set up an http server. But, even if you did that, you'd probably have firewall issues since most clients are not directly reachable by other clients unless they happen to be on the same sub-network as clients are usually behind a firewall.



来源:https://stackoverflow.com/questions/46066279/how-to-create-http-server-in-browser-using-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!