Skip to content

Commit

Permalink
modify example apps to use new url
Browse files Browse the repository at this point in the history
  • Loading branch information
saragee3 committed Jul 3, 2020
1 parent 823df18 commit c5d0bae
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@ Sockets is composed of two parts:
* A client library that loads on the front-end

```html
<script src="https://cdn.jsdelivr.net/gh/drashland/sockets@master/client.js">
```

```html
<script type="module" src="https://cdn.jsdelivr.net/gh/drashland/sockets@master/client-module.js">
<script type="module" src="https://cdn.jsdelivr.net/gh/drashland/sockets-client@latest/client.js">
```

## Features
Expand Down
8 changes: 3 additions & 5 deletions example_apps/browser_console/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ This is an interactive application where you send messages to the socket server
$ deno run --allow-net app.ts
```

3. Create your `index.html` file. This file contains an import for https://cdn.jsdelivr.net/gh/drashland/sockets@master/client.js, which is Sockets' `SocketClient` class. It has an API that is nearly identical to the `SocketServer` class.
3. Create your `index.html` file. This file contains an import for https://cdn.jsdelivr.net/gh/drashland/sockets-client@latest/client.js, which is Sockets' `SocketClient` class. It has an API that is nearly identical to the `SocketServer` class.

```html
<!DOCTYPE html>
Expand Down Expand Up @@ -86,10 +86,8 @@ This is an interactive application where you send messages to the socket server
</div>
<script>
let SocketClient;
import("https://cdn.jsdelivr.net/gh/drashland/sockets@master/client-module.js")
.then((Module) => {
SocketClient = Module.SocketClient;
});
import("https://cdn.jsdelivr.net/gh/drashland/sockets-client@latest/client.js")
.then((Module) => SocketClient = Module.default);
</script>
</body>
</html>
Expand Down
6 changes: 5 additions & 1 deletion example_apps/browser_console/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
<ul id="messages"></ul>
</div>
</div>
<script src="../../client.js"></script>
<script>
let SocketClient;
import("https://cdn.jsdelivr.net/gh/drashland/sockets-client@latest/client.js")
.then((Module) => SocketClient = Module.default);
</script>
</body>
</html>
8 changes: 4 additions & 4 deletions example_apps/browser_console_tls/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ This is an interactive application where you send messages to the socket server
$ deno run --allow-net app.ts
```

3. Create your `index.html` file. This file contains `<script src="https://cdn.jsdelivr.net/gh/drashland/sockets@master/client.js"></script>`, which is Sockets' `SocketClient` class.
3. Create your `index.html` file. This file contains `<script src="https://cdn.jsdelivr.net/gh/drashland/sockets-client@latest/client.js"></script>`, which is Sockets' `SocketClient` class.

```html
<!DOCTYPE html>
Expand All @@ -65,15 +65,15 @@ This is an interactive application where you send messages to the socket server
<strong>Open your console and follow the instructions below.</strong>
</p>
<p class="mb-2">1. Create a new connection to the socket server. This will be your socket client.</p>
<pre class="mb-5 border-t border-r border-b border-l border-gray-400 rounded-b p-4 overflow-auto bg-gray-200"><code>import('https://cdn.jsdelivr.net/gh/drashland/sockets@master/client.js').then(({default: SocketClient}) => {
<pre class="mb-5 border-t border-r border-b border-l border-gray-400 rounded-b p-4 overflow-auto bg-gray-200"><code>import('https://cdn.jsdelivr.net/gh/drashland/sockets-client@latest/client.js').then(({default: SocketClient}) => {
const socketClient = new SocketClient({
hostname: "localhost",
port: 3000,
protocol: "wss"
});
});</code></pre>
<p class="mb-2">2. When the socket server starts, it creates a channel named "Channel 1", so we set this socket client up to listen to that channel here. Any messages sent by the socket server to "Channel 1" will be handled by the callback below (the second argument).</p>
<pre class="mb-5 border-t border-r border-b border-l border-gray-400 rounded-b p-4 overflow-auto bg-gray-200"><code>import('https://cdn.jsdelivr.net/gh/drashland/sockets@master/client.js').then(({default: SocketClient}) => {
<pre class="mb-5 border-t border-r border-b border-l border-gray-400 rounded-b p-4 overflow-auto bg-gray-200"><code>import('https://cdn.jsdelivr.net/gh/drashland/sockets-client@latest/client.js').then(({default: SocketClient}) => {
const socketClient = new SocketClient({
hostname: "localhost",
port: 3000,
Expand All @@ -93,7 +93,7 @@ This is an interactive application where you send messages to the socket server
</code>
</pre>
<p class="mb-2">3. Send a message to the socket server.</p>
<pre class="mb-5 border-t border-r border-b border-l border-gray-400 rounded-b p-4 overflow-auto bg-gray-200"><code>import('https://cdn.jsdelivr.net/gh/drashland/sockets@master/client.js').then(({default: SocketClient}) => {
<pre class="mb-5 border-t border-r border-b border-l border-gray-400 rounded-b p-4 overflow-auto bg-gray-200"><code>import('https://cdn.jsdelivr.net/gh/drashland/sockets-client@latest/client.js').then(({default: SocketClient}) => {
const socketClient = new SocketClient({
hostname: "localhost",
port: 3000,
Expand Down
6 changes: 5 additions & 1 deletion example_apps/browser_console_tls/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
<ul id="messages"></ul>
</div>
</div>
<script src="https://cdn.jsdelivr.net/gh/drashland/sockets@master/client.js"></script>
<script>
let SocketClient;
import("https://cdn.jsdelivr.net/gh/drashland/sockets-client@latest/client.js")
.then((Module) => SocketClient = Module.default);
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion example_apps/chat/public/chat.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SocketClient } from "https://cdn.jsdelivr.net/gh/drashland/sockets@master/client.js";
import SocketClient from "https://cdn.jsdelivr.net/gh/drashland/sockets-client@latest/client.js";

// Create a new socket client. This class comes from /public/client.js.
const socket = new SocketClient({
Expand Down

0 comments on commit c5d0bae

Please sign in to comment.