-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTagEditorWeb.UserSocket.html
168 lines (152 loc) · 7.73 KB
/
TagEditorWeb.UserSocket.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="ExDoc v0.19.3">
<title>TagEditorWeb.UserSocket — Belethor's General Mods v0.0.1-2</title>
<link rel="stylesheet" href="dist/html-399e30b9b028e3059575.css" />
<script src="dist/sidebar_items-668dd872e9.js"></script>
<script async src="dist/html-399e30b9b028e3059575.js"></script>
</head>
<body data-type="modules">
<script>try { if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; } catch (e) { }</script>
<div class="main">
<button class="sidebar-button sidebar-toggle">
<span class="icon-menu" aria-hidden="true"></span>
<span class="sr-only">Toggle Sidebar</span>
</button>
<button class="sidebar-button night-mode-toggle">
<span class="icon-theme" aria-hidden="true"></span>
<span class="sr-only">Toggle Theme</span>
</button>
<section class="sidebar">
<a href="https://bgm.tetrarch.co" class="sidebar-projectLink">
<div class="sidebar-projectDetails">
<h1 class="sidebar-projectName">
Belethor's General Mods </h1>
<h2 class="sidebar-projectVersion">
v0.0.1-2
</h2>
</div>
</a>
<form class="sidebar-search" action="search.html">
<button type="submit" class="search-button">
<span class="icon-search" aria-hidden="true"></span>
</button>
<input name="q" type="text" id="search-list" class="search-input" placeholder="Search" aria-label="Search" autocomplete="off" />
</form>
<ul class="sidebar-listNav">
<li><a id="extras-list" href="#full-list">GUIDES</a></li>
<li><a id="modules-list" href="#full-list">Modules</a></li>
</ul>
<div class="gradient"></div>
<ul id="full-list" class="sidebar-fullList"></ul>
</section>
<section class="content">
<div class="content-outer">
<div id="content" class="content-inner">
<h1>
<small class="visible-xs">Belethor's General Mods v0.0.1-2</small>
TagEditorWeb.UserSocket
<a href="https://github.com/Belethors-General-Mods/belethor/blob/master/apps/tag_editor/lib/tag_editor_web/channels/user_socket.ex#L1" title="View Source" class="view-source" rel="help">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
</h1>
<section id="summary" class="details-list">
<h1 class="section-heading">
<a class="hover-link" href="#summary">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this section</span>
</a>
Summary
</h1>
<div class="summary-functions summary">
<h2>
<a href="#functions">Functions</a>
</h2>
<div class="summary-row">
<div class="summary-signature">
<a href="#connect/3">connect(params, socket, connect_info)</a>
</div>
<div class="summary-synopsis"><p>Callback implementation for <a href="https://hexdocs.pm/phoenix/1.4.0/Phoenix.Socket.html#c:connect/3"><code class="inline">Phoenix.Socket.connect/3</code></a></p>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#id/1">id(socket)</a>
</div>
<div class="summary-synopsis"><p>Identifies the socket connection</p>
</div>
</div>
</div>
</section>
<section id="functions" class="details-list">
<h1 class="section-heading">
<a class="hover-link" href="#functions">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this section</span>
</a>
Functions </h1>
<div class="functions-list">
<section class="detail" id="connect/3">
<div class="detail-header">
<a href="#connect/3" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature">connect(params, socket, connect_info)</span>
<a href="https://github.com/Belethors-General-Mods/belethor/blob/master/apps/tag_editor/lib/tag_editor_web/channels/user_socket.ex#L18" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<p>Callback implementation for <a href="https://hexdocs.pm/phoenix/1.4.0/Phoenix.Socket.html#c:connect/3"><code class="inline">Phoenix.Socket.connect/3</code></a>.</p>
</section>
</section>
<section class="detail" id="id/1">
<div class="detail-header">
<a href="#id/1" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature">id(socket)</span>
<a href="https://github.com/Belethors-General-Mods/belethor/blob/master/apps/tag_editor/lib/tag_editor_web/channels/user_socket.ex#L32" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<p>Identifies the socket connection.</p>
<p>Socket IDs are topics that allow you to identify all sockets for a given user:</p>
<pre><code class="nohighlight makeup elixir"><span class="kd">def</span><span class="w"> </span><span class="nf">id</span><span class="p" data-group-id="6472753985-1">(</span><span class="n">socket</span><span class="p" data-group-id="6472753985-1">)</span><span class="p">,</span><span class="w"> </span><span class="ss">do</span><span class="p">:</span><span class="w"> </span><span class="s">"users_socket:</span><span class="si" data-group-id="6472753985-2">#{</span><span class="n">socket</span><span class="o">.</span><span class="n">assigns</span><span class="o">.</span><span class="n">user_id</span><span class="si" data-group-id="6472753985-2">}</span><span class="s">"</span></code></pre>
<p>Would allow you to broadcast a "disconnect" event and terminate
all active sockets and channels for a given user:</p>
<pre><code class="nohighlight makeup elixir"><span class="nc">MyApp.Endpoint</span><span class="o">.</span><span class="n">broadcast</span><span class="p" data-group-id="0412923803-1">(</span><span class="s">"users_socket:"</span><span class="w"> </span><span class="o"><></span><span class="w"> </span><span class="n">user</span><span class="o">.</span><span class="n">id</span><span class="p">,</span><span class="w"> </span><span class="s">"disconnect"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="0412923803-2">%{</span><span class="p" data-group-id="0412923803-2">}</span><span class="p" data-group-id="0412923803-1">)</span></code></pre>
<p>Returning <code class="inline">nil</code> makes this socket anonymous.</p>
<p>Callback implementation for <a href="https://hexdocs.pm/phoenix/1.4.0/Phoenix.Socket.html#c:id/1"><code class="inline">Phoenix.Socket.id/1</code></a>.</p>
</section>
</section>
</div>
</section>
<footer class="footer">
<p>
<span class="line">
Built using
<a href="https://github.com/elixir-lang/ex_doc" title="ExDoc" target="_blank" rel="help noopener">ExDoc</a> (v0.19.3),
</span>
<span class="line">
designed by
<a href="https://twitter.com/dignifiedquire" target="_blank" rel="noopener" title="@dignifiedquire">Friedel Ziegelmayer</a>.
</span>
</p>
</footer>
</div>
</div>
</section>
</div>
</body>
</html>