Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WebSocketChannel2023] update example #186

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions websocket-channel-2023.html
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ <h3 property="schema:name">Subscription Example</h3>
<figure id="websocket-new" class="example listing" rel="schema:hasPart" resource="#websocket-new">
<p class="example-h"><span>Example</span>: Establishing a new WebSocket connection.</p>

<pre about="#websocket-new" property="schema:description" typeof="fabio:Script"><code>const ws = new WebSocket("wss://websocket.example/?auth=Ys3KiUq", "http://www.w3.org/ns/solid/notifications#WebSocketChannel2023");</code></pre>
<pre about="#websocket-new" property="schema:description" typeof="fabio:Script"><code>const ws = new WebSocket("wss://websocket.example/?auth=Ys3KiUq");</code></pre>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please quick remind me why is this no longer necessary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll double-check it. When I used it with channel type URI as the protocol it was resulting in some error. Simply removing it worked. BTW I think this is only used in a non-normative example, if we want the channel type to rely on it would need to be specified in a normative way.


<figcaption property="schema:name">JavaScript code to establish a <code>new WebSocket</code> connection</figcaption>
</figure>
Expand All @@ -433,8 +433,8 @@ <h3 property="schema:name">Subscription Example</h3>
<figure id="websocket-onclose-onmessage" class="example listing" rel="schema:hasPart" resource="#websocket-onclose-onmessage">
<p class="example-h"><span>Example</span>: Handling WebSocket events after the connection is established.</p>

<pre about="#websocket-onclose-onmessage" property="schema:description" typeof="fabio:Script"><code>ws.onclose(evt => reconnect(evt));</code>
<code>ws.onmessage(evt => console.log("Message received: ", evt))</code></pre>
<pre about="#websocket-onclose-onmessage" property="schema:description" typeof="fabio:Script"><code>ws.onclose = evt => reconnect(evt);</code>
<code>ws.onmessage = evt => console.log("Message received: ", evt)</code></pre>

<figcaption property="schema:name">JavaScript code to handle <code>onclose</code> and <code>onmessage</code> events</figcaption>
</figure>
Expand Down