Last active
December 13, 2021 05:48
-
-
Save arellano-gustavo/25d8e6569c64c9c0d7d3ba6cf7668a9a to your computer and use it in GitHub Desktop.
Un cliente del websocket de Binance
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Prueba de un cliente de un websocket</title> | |
<script type="text/javascript"> | |
var webSocket = new WebSocket('wss://fstream.binance.com/ws/btcusdt@trade'); | |
webSocket.onerror = function(event) { | |
alert(event.data); | |
}; | |
webSocket.onopen = function(event) { | |
document.getElementById('messages').innerHTML = 'New Connection established'; | |
}; | |
webSocket.onmessage = function(event) { | |
document.getElementById('messages').innerHTML = event.data; | |
}; | |
</script> | |
<style type="text/css"> | |
#messages { | |
height: 60px; | |
width: 980px; | |
border: 1px solid #ddd; | |
background: #f1f1f1; | |
overflow-y: scroll; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>Super Gus !!!</h1> | |
<div id="messages"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment