axum/examples/websockets/assets/script.js

10 lines
258 B
JavaScript
Raw Normal View History

const socket = new WebSocket('ws://localhost:3000/ws');
socket.addEventListener('open', function (event) {
socket.send('Hello Server!');
});
socket.addEventListener('message', function (event) {
console.log('Message from server ', event.data);
});