Changed
This commit is contained in:
parent
91e0557b20
commit
98f8b51a42
@ -26,7 +26,9 @@ async def serveStuff(websocket, path):
|
||||
# bad way to send balance to given user - FIX!!!
|
||||
elif requestText == "STATUSONUSER":
|
||||
name, balance = checkBalance("1")
|
||||
await websocket.send(balance)
|
||||
print(name)
|
||||
await websocket.send(f"Your balance is: {balance}")
|
||||
await websocket.send(f"Welcome, {name}!")
|
||||
else:
|
||||
await websocket.send("We don't accept DoS")
|
||||
|
||||
|
@ -10,7 +10,9 @@
|
||||
<body>
|
||||
<h1 id="odometer" class="odometer">This is where you'll see the thing</h1>
|
||||
<script type="text/javascript" src="scripts/getCurrentCoins.js"></script>
|
||||
<br>
|
||||
<h2 id="balance">Your balance is:</h2>
|
||||
<h2 id="username"></h2>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,6 +1,6 @@
|
||||
socketAdress="ws://localhost:8765"
|
||||
// Lacking protocol for ids lmao
|
||||
document.cookie = "id=1";
|
||||
document.cookie = "id=2";
|
||||
|
||||
function currencyTicker(){
|
||||
var ws = new WebSocket(socketAdress);
|
||||
@ -26,10 +26,12 @@ function userBalance(){
|
||||
ws.onmessage = function(evt){
|
||||
var balanceStatus = evt.data;
|
||||
// this doesnt work, fix pls
|
||||
var websiteReplace = "Your balance is:${balanceStatus}"
|
||||
w = document.getElementById("balance").innerHTML = websiteReplace
|
||||
w = document.getElementById("balance").innerHTML = balanceStatus;
|
||||
ws.onmessage = function(evt){
|
||||
w = document.getElementById("username").innerHTML = evt.data;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
var t=setInterval(currencyTicker,5000);
|
||||
var y=setInterval(userBalance,10000);
|
||||
var y=setInterval(userBalance,5000);
|
||||
|
Reference in New Issue
Block a user