Created
August 2, 2018 23:10
-
-
Save cn0047/94662ff233448fe7edc2d207b9a73e8f to your computer and use it in GitHub Desktop.
Super simple PHP WebSocket example - websockets.html
This file contains hidden or 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> | |
<body> | |
<div id="root"></div> | |
<script> | |
var host = 'ws://0.0.0.0:12345/websockets.php'; | |
var socket = new WebSocket(host); | |
socket.onmessage = function(e) { | |
document.getElementById('root').innerHTML = e.data; | |
}; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment