-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsource-class-YnievesDotNet.FourStream.Handlers.Events.ConnectionOpen.html
197 lines (174 loc) · 10.5 KB
/
source-class-YnievesDotNet.FourStream.Handlers.Events.ConnectionOpen.html
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex">
<title>File Handlers/Events/ConnectionOpen.php | FourStream</title>
<link rel="stylesheet" href="resources/bootstrap.min.css?973e37a8502921d56bc02bb55321f45b072b6f71">
<link rel="stylesheet" href="resources/style.css?49f43d3208c5d7e33fa16d36107a345bf11cc00d">
</head>
<body>
<nav id="navigation" class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<a href="index.html" class="navbar-brand">FourStream</a>
</div>
<div class="collapse navbar-collapse">
<form id="search" class="navbar-form navbar-left" role="search">
<input type="hidden" name="cx" value="">
<input type="hidden" name="ie" value="UTF-8">
<div class="form-group">
<input type="text" name="q" class="search-query form-control" placeholder="Search">
</div>
</form>
<ul class="nav navbar-nav">
<li>
<span>Namespace</span> </li>
<li>
<span>Class</span> </li>
<li class="divider-vertical"></li>
<li>
<a href="-API-documentation.zip" title="Download documentation as ZIP archive"><span>Download</span></a>
</li>
</ul>
</div>
</div>
</nav>
<div id="left">
<div id="menu">
<div id="groups">
<h3>Namespaces</h3>
<ul>
<li>
<a href="namespace-YnievesDotNet.html">
YnievesDotNet<span></span>
</a>
<ul>
<li>
<a href="namespace-YnievesDotNet.FourStream.html">
FourStream<span></span>
</a>
<ul>
<li>
<a href="namespace-YnievesDotNet.FourStream.Command.html">
Command </a>
</li>
<li>
<a href="namespace-YnievesDotNet.FourStream.Events.html">
Events </a>
</li>
<li>
<a href="namespace-YnievesDotNet.FourStream.Facades.html">
Facades </a>
</li>
<li>
<a href="namespace-YnievesDotNet.FourStream.FourStream.html">
FourStream </a>
</li>
<li>
<a href="namespace-YnievesDotNet.FourStream.Handlers.html">
Handlers<span></span>
</a>
<ul>
<li>
<a href="namespace-YnievesDotNet.FourStream.Handlers.Events.html">
Events </a>
</li>
</ul></li>
<li>
<a href="namespace-YnievesDotNet.FourStream.Models.html">
Models </a>
</li>
<li>
<a href="namespace-YnievesDotNet.FourStream.Traits.html">
Traits </a>
</li>
</ul></li></ul></li>
</ul>
</div>
<div id="elements">
<h3>Classes</h3>
<ul>
<li><a href="class-YnievesDotNet.FourStream.Command.FourStreamStartCommand.html">YnievesDotNet\FourStream\Command\FourStreamStartCommand</a></li>
<li><a href="class-YnievesDotNet.FourStream.Events.BinaryMessageReceived.html">YnievesDotNet\FourStream\Events\BinaryMessageReceived</a></li>
<li><a href="class-YnievesDotNet.FourStream.Events.ConnectionClose.html">YnievesDotNet\FourStream\Events\ConnectionClose</a></li>
<li><a href="class-YnievesDotNet.FourStream.Events.ConnectionOpen.html">YnievesDotNet\FourStream\Events\ConnectionOpen</a></li>
<li><a href="class-YnievesDotNet.FourStream.Events.ErrorGenerated.html">YnievesDotNet\FourStream\Events\ErrorGenerated</a></li>
<li><a href="class-YnievesDotNet.FourStream.Events.MessageReceived.html">YnievesDotNet\FourStream\Events\MessageReceived</a></li>
<li><a href="class-YnievesDotNet.FourStream.Events.PingReceived.html">YnievesDotNet\FourStream\Events\PingReceived</a></li>
<li><a href="class-YnievesDotNet.FourStream.Facades.FourStream.html">YnievesDotNet\FourStream\Facades\FourStream</a></li>
<li><a href="class-YnievesDotNet.FourStream.FourStream.html">YnievesDotNet\FourStream\FourStream</a></li>
<li><a href="class-YnievesDotNet.FourStream.FourStream.FourStreamServer.html">YnievesDotNet\FourStream\FourStream\FourStreamServer</a></li>
<li><a href="class-YnievesDotNet.FourStream.FourStreamRouter.html">YnievesDotNet\FourStream\FourStreamRouter</a></li>
<li><a href="class-YnievesDotNet.FourStream.FourStreamServiceProvider.html">YnievesDotNet\FourStream\FourStreamServiceProvider</a></li>
<li><a href="class-YnievesDotNet.FourStream.Handlers.Events.BinaryMessageReceived.html">YnievesDotNet\FourStream\Handlers\Events\BinaryMessageReceived</a></li>
<li><a href="class-YnievesDotNet.FourStream.Handlers.Events.ConnectionClose.html">YnievesDotNet\FourStream\Handlers\Events\ConnectionClose</a></li>
<li><a href="class-YnievesDotNet.FourStream.Handlers.Events.ConnectionOpen.html">YnievesDotNet\FourStream\Handlers\Events\ConnectionOpen</a></li>
<li><a href="class-YnievesDotNet.FourStream.Handlers.Events.ErrorGenerated.html">YnievesDotNet\FourStream\Handlers\Events\ErrorGenerated</a></li>
<li><a href="class-YnievesDotNet.FourStream.Handlers.Events.MessageReceived.html">YnievesDotNet\FourStream\Handlers\Events\MessageReceived</a></li>
<li><a href="class-YnievesDotNet.FourStream.Handlers.Events.PingReceived.html">YnievesDotNet\FourStream\Handlers\Events\PingReceived</a></li>
<li><a href="class-YnievesDotNet.FourStream.Models.FourStreamNode.html">YnievesDotNet\FourStream\Models\FourStreamNode</a></li>
<li><a href="class-YnievesDotNet.FourStream.Models.FourStreamTag.html">YnievesDotNet\FourStream\Models\FourStreamTag</a></li>
</ul>
<h3>Traits</h3>
<ul>
<li><a href="class-YnievesDotNet.FourStream.Traits.FourStreamUserNodes.html">YnievesDotNet\FourStream\Traits\FourStreamUserNodes</a></li>
</ul>
</div>
</div>
</div>
<div id="splitter"></div>
<div id="right">
<div id="rightInner">
<pre id="source"><code><span id="1" class="l"><a href="#1"> 1 </a><span class="xlang"><?php</span>
</span><span id="2" class="l"><a href="#2"> 2 </a>
</span><span id="3" class="l"><a href="#3"> 3 </a><span class="php-keyword1">namespace</span> YnievesDotNet\FourStream\Handlers\Events;
</span><span id="4" class="l"><a href="#4"> 4 </a>
</span><span id="5" class="l"><a href="#5"> 5 </a><span class="php-keyword1">use</span> Illuminate\Queue\InteractsWithQueue;
</span><span id="6" class="l"><a href="#6"> 6 </a><span class="php-keyword1">use</span> Illuminate\Contracts\Queue\ShouldQueue;
</span><span id="7" class="l"><a href="#7"> 7 </a><span class="php-keyword1">use</span> YnievesDotNet\FourStream\Events\ConnectionOpen <span class="php-keyword1">as</span> Open;
</span><span id="8" class="l"><a href="#8"> 8 </a><span class="php-keyword1">use</span> YnievesDotNet\FourStream\Models\FourStreamNode <span class="php-keyword1">as</span> FSNode;
</span><span id="9" class="l"><a href="#9"> 9 </a><span class="php-keyword1">use</span> Illuminate\Support\Facades\Auth;
</span><span id="10" class="l"><a href="#10">10 </a>
</span><span id="11" class="l"><a href="#11">11 </a><span class="php-keyword1">class</span> ConnectionOpen
</span><span id="12" class="l"><a href="#12">12 </a>{
</span><span id="13" class="l"><a href="#13">13 </a> <span class="php-comment">/**
</span></span><span id="14" class="l"><a href="#14">14 </a><span class="php-comment"> * Create the event handler.
</span></span><span id="15" class="l"><a href="#15">15 </a><span class="php-comment"> *
</span></span><span id="16" class="l"><a href="#16">16 </a><span class="php-comment"> */</span>
</span><span id="17" class="l"><a href="#17">17 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> __construct()
</span><span id="18" class="l"><a href="#18">18 </a> {
</span><span id="19" class="l"><a href="#19">19 </a>
</span><span id="20" class="l"><a href="#20">20 </a> }
</span><span id="21" class="l"><a href="#21">21 </a>
</span><span id="22" class="l"><a href="#22">22 </a> <span class="php-comment">/**
</span></span><span id="23" class="l"><a href="#23">23 </a><span class="php-comment"> * Handle the Event.
</span></span><span id="24" class="l"><a href="#24">24 </a><span class="php-comment"> *
</span></span><span id="25" class="l"><a href="#25">25 </a><span class="php-comment"> * @param Open $event
</span></span><span id="26" class="l"><a href="#26">26 </a><span class="php-comment"> * @return void
</span></span><span id="27" class="l"><a href="#27">27 </a><span class="php-comment"> */</span>
</span><span id="28" class="l"><a href="#28">28 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> handle(Open <span class="php-var">$event</span>)
</span><span id="29" class="l"><a href="#29">29 </a> {
</span><span id="30" class="l"><a href="#30">30 </a> <span class="php-var">$node</span> = <span class="php-var">$event</span>->bucket->getSource()->getConnection()->getCurrentNode();
</span><span id="31" class="l"><a href="#31">31 </a> <span class="php-var">$user</span> = Auth::user();
</span><span id="32" class="l"><a href="#32">32 </a> <span class="php-keyword1">if</span>(<span class="php-var">$user</span>)
</span><span id="33" class="l"><a href="#33">33 </a> {
</span><span id="34" class="l"><a href="#34">34 </a> <span class="php-var">$tocken</span> = <span class="php-var">$user</span>->generateTocken();
</span><span id="35" class="l"><a href="#35">35 </a> } <span class="php-keyword1">else</span> {
</span><span id="36" class="l"><a href="#36">36 </a> <span class="php-var">$tocken</span> = <span class="php-quote">"public"</span>;
</span><span id="37" class="l"><a href="#37">37 </a> }
</span><span id="38" class="l"><a href="#38">38 </a> <span class="php-keyword1">if</span> (config(<span class="php-quote">'app.debug'</span>)) {
</span><span id="39" class="l"><a href="#39">39 </a> <span class="php-keyword1">echo</span> <span class="php-quote">"> Connection Opened: "</span> . <span class="php-var">$node</span>->getId() . <span class="php-quote">" tocken: "</span> . <span class="php-var">$tocken</span> . <span class="php-quote">"\n"</span>;
</span><span id="40" class="l"><a href="#40">40 </a> }
</span><span id="41" class="l"><a href="#41">41 </a> }
</span><span id="42" class="l"><a href="#42">42 </a>}
</span><span id="43" class="l"><a href="#43">43 </a></span></code></pre>
</div>
<div id="footer">
FourStream API documentation generated by <a href="http://apigen.org">ApiGen</a>
</div>
</div>
<script src="resources/combined.js?533e23ef2f02bd4b20548834a028566b6eb403e0"></script>
<script src="elementlist.js?5a53130dea87ed1c135c563dcac56bcec3a4893e"></script>
</body>
</html>