Created
December 5, 2016 06:18
-
-
Save malkitsingh/e0d68e5e8b0cc64ece48f1295d622926 to your computer and use it in GitHub Desktop.
Connecting/Testing socket
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title> | |
Socket Testing | |
</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.6.0/socket.io.min.js"></script> | |
<script type="text/javascript"> | |
var socket = io.connect('http://SERVERIP:8083'); | |
$(document).ready(function(){ | |
console.log('new ready...'); | |
setTimeout(function () { | |
setInterval(function () { | |
console.log("Set Interval Function Called"); | |
socket.emit('getUpdatedLocation', { device_id: "5843b1cbfafa400ee0e0805a" }); | |
}, 10000); | |
}, 5000); | |
socket.on('getUpdatedLocationResult', function (data) { | |
if (data.IsSuccess == true) | |
{ | |
console.log('came in true'); | |
} | |
else{ | |
console.log('came in false'); | |
} | |
console.log('Get Update Location Result ' + JSON.stringify(data)); | |
}); | |
}); | |
</script | |
</head> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment