initial commit
This commit is contained in:
11
resources/public/js/index.js
Normal file
11
resources/public/js/index.js
Normal file
@@ -0,0 +1,11 @@
|
||||
const proto = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
const socket = new WebSocket(`${proto}//${window.location.host}/ws`);
|
||||
|
||||
socket.onopen = () => {
|
||||
console.log('Connected to server...');
|
||||
socket.send('world');
|
||||
};
|
||||
|
||||
socket.onmessage = (e) => {
|
||||
console.log('Received message from server: ', e.data);
|
||||
};
|
||||
Reference in New Issue
Block a user