-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsocketTest.js
More file actions
32 lines (29 loc) · 802 Bytes
/
Copy pathsocketTest.js
File metadata and controls
32 lines (29 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
This file is just a script to test the networking.
Can safely be ignored.
*/
import { io } from "socket.io-client";
const socket = io('http://35.228.7.69:3000/', {
auth: {
name: 'David',
password: 'test',
new: 'false'
}
});
// Local version of login
// const socket = io('http://127.0.0.1:3000/', {
// auth: {
// name: 'David',
// password: 'test',
// new: 'false'
// }
// });
socket.on('disconnect', (reason) => console.log(reason));
socket.on('connect_error', (err) => console.log(err));
socket.on('connect', () => console.log(socket.id));
setTimeout(() => socket.emit('getTopTen', (response) => {
console.log(response);
}), 2000);
// Test game requests
// socket.on('gameRequest', (...args) => console.log(args));
setTimeout(() => socket.disconnect(), 6000);