Reputation: 29
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
function WebSocketTest() {
var ws = $.gracefulWebSocket("ws://localhost/Node/");
ws.onopen=function(ev){
alert('Connected to server');
};
ws.send("Client is sending message");
ws.onmessage = function (event) {
var messageFromServer = event.data;
alert('Message' +messageFromServer);
};
ws.onerror=function(ev){
alert('Error' +ev.code);
};
}
<div >
<a href="javascript:WebSocketTest()">Run WebSocket</a>
</div>
Here I have also added gracefulWebSocket library but Stackoverflow just removed it .I am using chrome browser for this Please help me Thanks in advance
Upvotes: 1
Views: 1158
Reputation:
You include js file from there? https://github.com/ffdead/jquery-graceful-websocket
What console tells you? (Developer Tools - F12 key shortcut on Chrome).
Upvotes: 0