forked from TF2Stadium/Helen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
socket.go
50 lines (44 loc) · 1007 Bytes
/
socket.go
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package testhelpers
import (
"github.com/gorilla/websocket"
)
//Create lobby with id 1
func SocketCreateLobby(conn *websocket.Conn) {
args := map[string]interface{}{
"id": "1",
"data": map[string]interface{}{
"request": "lobbyCreate",
"map": "cp_badlands",
"type": "6s",
"league": "etf2l",
"server": "testerino",
"rconpwd": "testerino",
"whitelistID": "123",
"mumbleRequired": true,
}}
conn.WriteJSON(args)
ReadMessages(conn, 2, nil)
}
//Join lobby
func SocketJoinLobby(conn *websocket.Conn) {
args := map[string]interface{}{
"id": "1",
"data": map[string]interface{}{
"request": "lobbySpectatorJoin",
"id": 1,
},
}
conn.WriteJSON(args)
ReadMessages(conn, 2, nil)
args = map[string]interface{}{
"id": "1",
"data": map[string]interface{}{
"request": "lobbyJoin",
"id": 1,
"team": "blu",
"class": "scout1",
},
}
conn.WriteJSON(args)
ReadMessages(conn, 4, nil)
}