-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathusers.php
More file actions
68 lines (54 loc) · 1.42 KB
/
users.php
File metadata and controls
68 lines (54 loc) · 1.42 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
include_once 'session.php';
class WebSocketUser{
public $socket;
public $id;
public $headers = array();
public $handshake = false;
public $handlingPartialPacket = false;
public $partialBuffer = "";
public $sendingContinuous = false;
public $partialMessage = "";
public $hasSentClose = false;
public $authenticated = false;
public $subscribed = false;
public $username = "";
public $module = "";
public $message = "";
public $session;
function __construct($id, $socket) {
$this->id = $id;
$this->socket = $socket;
$this->session = new SESSION();
}
public function authenticate($key){
if ($this->session->validate_basic_token($key)){
$this->authenticated = true;
$this->username = $this->session->username;
return true;
}else
return false;
}
public function subscribe($module){
if ($this->session->validate_module($module, $this->username)){
$this->subscribed = true;
$this->module = $module;
return true;
}else{
return false;
}
}
public function process(){
$this->session->api_what($this->module);
return $this->session->response;
}
public function send($action, $value){
$this->session->api_what($this->module, $value, $action);
return $this->session->response;
}
public function disconnect(){
if ($this->subscribed){
$this->session->disconnect_module($this->module);
}
}
}