Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  <button id="bt">send</button>
  <div id="mes"></div>
</body>
</html>
 
const bt = document.getElementById("bt");
const mes = document.getElementById("mes");
const ws = new WebSocket("wss://4191333.xyz:3052/?room=test");
bt.onclick = ()=>{
  ws.send("test");
}
ws.onmessage = (message)=>{
  mes.innerHTML += message.data+"<br>";
}
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers