my connection to WebSocket is getting Disconnected continuously. I'm working in folder realtime on localhost.
How to keep WebSocket connection live?

How to use WebSocket in javascript?

Link: http://localhost/realtime/

<script language="javascript" type="text/javascript">  

    var myWebSocket = new WebSocket("ws://localhost/realtime");

    myWebSocket.onopen = function(evt) { alert("Connection open ..."); }; 

    myWebSocket.onmessage = function(evt) { alert( "Received Message: " + evt.data); };

    myWebSocket.onclose = function(evt) { alert("Connection closed."); }; //This line is always true

</script>

How to insert data to 'generalposts' table id, post field using socket?

How to fetch data using socket from above table & fields?

I used this too var myWebSocket = new WebSocket("ws://localhost:8005/realtime"); and var myWebSocket = new WebSocket("ws://localhost:9998/realtime");

(Ref:http://www.tutorialspoint.com/html5/html5_websocket.htm)

Any body please help me....!!!!!!!!

I've made list. How to implement following?

//create a new WebSocket object.
websocket = new WebSocket("ws://localhost:9000/realtime/demo.php");
websocket.onopen = function(evt) { /* do stuff / }; //on open event
websocket.onclose = function(evt) { /
do stuff / }; //on close event
websocket.onmessage = function(evt) { /
do stuff / }; //on message event
websocket.onerror = function(evt) { /
do stuff */ }; //on error event
websocket.send(message); //send method
websocket.close(); //close method

I have almost same problem dude

When a websocket connection gets disconnected it's usually because of an error with the websocket server. I would use an external provider like PushRadar to handle websocket connections.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.