Javascript TCP connection to server

2019-03-21 14:18发布

问题:

I have created server daemon, that produces some data, like messages and so. But, what im interested in - client monitoring. For example i have web page, and i need to establish persistent Tcp connection to server and show all incoming data into textbox. I know it can be done with flash, but im searching for JS implementation.

Is it possible and what`s the best practices ?

回答1:

What you're asking for is known as Comet. Plenty of server software and client libraries exist - see the linked Wikipedia page.



回答2:

WebSockets is designed to solve this problem.