1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 02:17:05 +00:00

_examples/websocket/basic: add a nodejs client and provide a README.md on how to run the websocket clients and the server

Former-commit-id: a98a80996d7d95fa947e72c71803407682229fa7
This commit is contained in:
Gerasimos (Makis) Maropoulos
2019-06-13 12:15:01 +03:00
parent 5f148987f7
commit 272566950d
14 changed files with 126 additions and 92 deletions

View File

@@ -10,7 +10,7 @@
However, `neffos.(min.)js` is a NPM package too so alternatively,
you can use it as dependency on your package.json and all nodejs-npm tooling become available:
see the "browserify" example for more-->
<script src="https://cdn.jsdelivr.net/npm/neffos.js@0.1.8/dist/neffos.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/neffos.js@0.1.12/dist/neffos.min.js"></script>
<script>
// `neffos` global variable is available now.
var scheme = document.location.protocol == "https:" ? "wss" : "ws";
@@ -28,6 +28,8 @@
}
function handleNamespaceConnectedConn(nsConn) {
nsConn.emit("Hello from browser client side!");
let inputTxt = document.getElementById("input");
let sendBtn = document.getElementById("sendBtn");
@@ -62,7 +64,7 @@
// You can either wait to conenct or just conn.connect("connect")
// and put the `handleNamespaceConnectedConn` inside `_OnNamespaceConnected` callback instead.
// const nsConn = await conn.connect("default");
// handleNamespaceConnectedConn(nsConn);
// nsConn.emit(...); handleNamespaceConnectedConn(nsConn);
conn.connect("default");
} catch (err) {