I am trying to write some simple chat client in javascript, but I need a way to update messages in real time. Although I could use the xmlhttprequest function, I believe that it uses the TCP / IP port on the server and, perhaps more importantly, is not allowed in my current hosting package. In any case, this is not an ideal solution, since it seems a little inconvenient to constantly open the connection, and it would be much easier if I could just listen to the port and take the data as it arrives. I looked on the Internet and found many links to the comet and continuous polling, which are unsatisfactory, and many people say that javascript is actually not suitable for it, which I can agree with. Now I learned a little more about how the Internet works, it seems doable.I do not need to worry about sending messages so far; I can handle this, but is there any way to listen on a specific port in javascript?
John
source
share