javascript - Jetty Web Socket Timeout -


i trying establish web socket connection using jetty 9.3.0 rc.

function checkdetails(port) {      var ws = new websocket("ws://localhost:9995/application");      ws.onopen = function(event) {       console.log("onopen called...");     }     ws.onerror = function(event){       console.log('onerror called...');     }      ws.onmessage = function(event) {       console.log("onmessage called..." + event.data);     }      ws.onclose = function(event) {       console.log("onclose called..." + port);       console.log(event);       ws.close();     }   } 

the code works fine if port 9995 used creating web socket connection not occupied other process.

var ws = new websocket("ws://localhost:9995/application"); 

but in case if port is occupied other process, keeps on trying connect port until port released.

i need provide timeout if port not respond in 3 mins web socket should release (or stop listening) port , display console log.

please let me know simplest way achieve this.

from client side connecting web socket. if port (9995 in case) available connect means program (in server mode) listening , responding. , - answers data. so, can connect such program if exists , answers or cannot if there no server listener port 9995. when "port occupied" other process means process exist , answers. , process respond whatever designed for. so, client side, connect existing , running process listens port in server mode. that's , that's all.

however, if ignore comment op client side first suggestion on server configuration , check in multithread mode , can answer , proceed multiple requests @ once. describing looks have singe thread process works 1 request , can answer next 1 when current finished. sounds "process occupied". since comment insist talking client side speculation unnecessary.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -