-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHow To Use
39 lines (35 loc) · 899 Bytes
/
How To Use
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
using ZeLoot;
using ZeLoot.Parse;
using ZeLoot.WebSocket;
public class ZeLootWebSocketLibrary
{
[SerializeField] private string host;
[SerializeField] private bool autoConnect;
private static ZeLootWebSocket ZLWS;
[Space(20)]
[SerializeField] private ZeLootWebSocketStatus wsStatus;
[SerializeField] private float ping;
private async void Start()
{
//connecting websocket
await ZLWS.Connect(host); //connecting to server
//get status of connetion
wsStatus = ZLWS.GetNewStatus;
//verify status
if(wsStatus == ZeLootWebSocketStaus.Connected)
{
//create data
string play_data = @"
{
"event":"play",
"data":"{"id":1,"how": "squad","mode":"zombie"}"
}
"
//parse data
byte[] data = ZeLootParse.GetBytes(play_data);
//send data
ZLWS.Send(data);
//received
}
}
}