Skip to content

Commit

Permalink
Merge pull request #25 from gelic-idealab/dev
Browse files Browse the repository at this point in the history
Updated README and Added Licenses
  • Loading branch information
parseccentric authored Dec 2, 2021
2 parents a5f4c7d + acf3f8c commit d5769cf
Show file tree
Hide file tree
Showing 10 changed files with 316 additions and 21 deletions.
55 changes: 41 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
[Learn more about the Komodo Platform](https://github.com/gelic-idealab/komodo-docs)

## What is it?
The relay server facilitates client communication during multiplayer sessions. It allows clients to join session namespaces or 'rooms', propagates client updates (including positions within the VR scene and interactions with entities or other clients), coordinates chat sessions (including text and voice/video/screen), maintains session state (including active clients, entity and scene state, session properties), and captures data during session recording.
The relay server facilitates client communication during multiplayer sessions. It allows clients to join session namespaces or 'rooms', propagates client updates (including positions within the VR scene and interactions with entities or other clients), coordinates chat sessions (including text and voice/video/screen) [1], maintains session state (including active clients, entity and scene state, session properties), and captures data during session recording.

1. [Development](#development)
2. [Testing](#testing)
2. [Deployment](#deployment)
- [Komodo Relay Server](#komodo-relay-server)
- [What is it?](#what-is-it)
- [Development](#development)
- [Getting started](#getting-started)
- [Footnotes](#footnotes)
- [Testing](#testing)
- [Deployment](#deployment)

_______________
<a name="development"></a>
Expand All @@ -17,24 +21,47 @@ You will need [Node.js](https://nodejs.org/en/download/) installed on your machi
1. Clone this repository
* `git clone https://github.com/gelic-idealab/komodo-relay.git`
* `cd komodo-relay/`
2. Install dependencies

2. Configure the Docker container
* `cp config.template.js config.js`
* Edit config.js:
* db: connection information for `komodo-db` or a comparable MySQL server
* azure: Microsoft Speech SDK credentials
* capture: local file directory for capture files
3. Install dependencies
* `npm install`
3. Run the relay server
4. Run the relay server
* `node serve.js`

| dependencies | usage |
| Dependencies (Production) | Usage |
|:---------------------------------------------------|:------|
| [Microsoft Speech SDK](https://docs.microsoft.com/en-us/javascript/api/microsoft-cognitiveservices-speech-sdk/?view=azure-node-latest) [1] | Processing client audio for speech-to-text |
| [mkdirp](https://github.com/isaacs/node-mkdirp) | Creating directories for writing capture files |
| [mysql2](https://github.com/sidorares/node-mysql2) | Connecting to komodo-db for connection, capture records |
| [object.fromentries](https://github.com/es-shims/Object.fromEntries) | Polyfill for turning a map into an object |
| [socket.io](https://github.com/socketio/socket.io) | Managing session namespaces, joining clients to sessions, listening for and emitting custom events (such as position updates), portal text & speech-to-text chat [1] |
| [winston](https://github.com/winstonjs/winston) | Logging |

| Dependencies (Development) | Usage |
|:---------------------------------------------------|:------|
| [socket.io](https://github.com/socketio/socket.io) | managing session namespaces, joining clients to sessions, listening for and emitting custom events (such as position updates), portal text & speech-to-text chat |
| [peer.js](https://github.com/peers/peerjs) | WebRTC signaling for voice/video chat and screen sharing |
| [Microsoft Speech SDK](https://docs.microsoft.com/en-us/javascript/api/microsoft-cognitiveservices-speech-sdk/?view=azure-node-latest) | Processing client audio for speech-to-text |
| [bson](https://github.com/mongodb/js-bson) | binary encoding of client audio packets during session recording |
| [wavefile](https://github.com/rochars/wavefile) | resampling client audio for speech-to-text |
| [winston](https://github.com/winstonjs/winston) | logging |
| [Mocha](https://github.com/mochajs/mocha) | Unit testing |
| [Instanbul](https://github.com/istanbuljs/nyc) | Code coverage |
| [Should.JS](https://github.com/shouldjs/should.js) | Easy-to-read assertions |

## Footnotes

[1] NOTE: The chat namespace is experimental and not ready for production usage.

_______________
<a name="testing"></a>
### Testing
The `tests` directory contains scripts which use and validate relay functionality. Please run tests during development, and especially before submitting pull requests.
The `test` directory contains scripts which use and validate relay functionality. Please run tests during development, and especially before submitting pull requests.

`npm run test`

OR

`nyc mocha --debug-brk --exit`
______________
<a name="deployment"></a>
### Deployment
Expand Down
33 changes: 33 additions & 0 deletions admin/index.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
/* // University of Illinois/NCSA
// Open Source License
// http://otm.illinois.edu/disclose-protect/illinois-open-source-license
// Copyright (c) 2020 Grainger Engineering Library Information Center. All rights reserved.
// Developed by: IDEA Lab
// Grainger Engineering Library Information Center - University of Illinois Urbana-Champaign
// https://library.illinois.edu/enx
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal with
// the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to
// do so, subject to the following conditions:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimers.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimers in the documentation
// and/or other materials provided with the distribution.
// * Neither the names of IDEA Lab, Grainger Engineering Library Information Center,
// nor the names of its contributors may be used to endorse or promote products
// derived from this Software without specific prior written permission.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
// SOFTWARE. */

#allSessions, #allSockets {
white-space: pre-wrap;
}
Expand Down
33 changes: 33 additions & 0 deletions admin/index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
<!-- // University of Illinois/NCSA
// Open Source License
// http://otm.illinois.edu/disclose-protect/illinois-open-source-license
// Copyright (c) 2020 Grainger Engineering Library Information Center. All rights reserved.
// Developed by: IDEA Lab
// Grainger Engineering Library Information Center - University of Illinois Urbana-Champaign
// https://library.illinois.edu/enx
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal with
// the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to
// do so, subject to the following conditions:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimers.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimers in the documentation
// and/or other materials provided with the distribution.
// * Neither the names of IDEA Lab, Grainger Engineering Library Information Center,
// nor the names of its contributors may be used to endorse or promote products
// derived from this Software without specific prior written permission.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
// SOFTWARE. -->

<!doctype html>
<html lang="en">
<head>
Expand Down
35 changes: 35 additions & 0 deletions admin/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
// University of Illinois/NCSA
// Open Source License
// http://otm.illinois.edu/disclose-protect/illinois-open-source-license

// Copyright (c) 2020 Grainger Engineering Library Information Center. All rights reserved.

// Developed by: IDEA Lab
// Grainger Engineering Library Information Center - University of Illinois Urbana-Champaign
// https://library.illinois.edu/enx

// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal with
// the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to
// do so, subject to the following conditions:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimers.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimers in the documentation
// and/or other materials provided with the distribution.
// * Neither the names of IDEA Lab, Grainger Engineering Library Information Center,
// nor the names of its contributors may be used to endorse or promote products
// derived from this Software without specific prior written permission.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
// SOFTWARE.

/* jshint esversion: 6 */

//This script requires socket.io.dev.js

// Replace these with your own server's URLs.
Expand Down
35 changes: 35 additions & 0 deletions session.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
// University of Illinois/NCSA
// Open Source License
// http://otm.illinois.edu/disclose-protect/illinois-open-source-license

// Copyright (c) 2020 Grainger Engineering Library Information Center. All rights reserved.

// Developed by: IDEA Lab
// Grainger Engineering Library Information Center - University of Illinois Urbana-Champaign
// https://library.illinois.edu/enx

// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal with
// the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to
// do so, subject to the following conditions:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimers.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimers in the documentation
// and/or other materials provided with the distribution.
// * Neither the names of IDEA Lab, Grainger Engineering Library Information Center,
// nor the names of its contributors may be used to endorse or promote products
// derived from this Software without specific prior written permission.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
// SOFTWARE.

/* jshint esversion: 6 */

class Session {
constructor(id) {
this.id = id;
Expand Down
2 changes: 1 addition & 1 deletion sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -1483,7 +1483,7 @@ module.exports = {
session_id,
client_id,
socket.id,
`in disconnectSocket, disconnectedAction callback was not provided`
`in disconnectSocket, .disconnectAction callback was not provided`
);
}

Expand Down
33 changes: 33 additions & 0 deletions test/test-session.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
// University of Illinois/NCSA
// Open Source License
// http://otm.illinois.edu/disclose-protect/illinois-open-source-license

// Copyright (c) 2020 Grainger Engineering Library Information Center. All rights reserved.

// Developed by: IDEA Lab
// Grainger Engineering Library Information Center - University of Illinois Urbana-Champaign
// https://library.illinois.edu/enx

// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal with
// the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to
// do so, subject to the following conditions:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimers.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimers in the documentation
// and/or other materials provided with the distribution.
// * Neither the names of IDEA Lab, Grainger Engineering Library Information Center,
// nor the names of its contributors may be used to endorse or promote products
// derived from this Software without specific prior written permission.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
// SOFTWARE.

/* jshint esversion: 6 */

// TODO: add test for getting state
Expand Down
39 changes: 36 additions & 3 deletions test/test-sync-clients-and-sockets.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
// University of Illinois/NCSA
// Open Source License
// http://otm.illinois.edu/disclose-protect/illinois-open-source-license

// Copyright (c) 2020 Grainger Engineering Library Information Center. All rights reserved.

// Developed by: IDEA Lab
// Grainger Engineering Library Information Center - University of Illinois Urbana-Champaign
// https://library.illinois.edu/enx

// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal with
// the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to
// do so, subject to the following conditions:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimers.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimers in the documentation
// and/or other materials provided with the distribution.
// * Neither the names of IDEA Lab, Grainger Engineering Library Information Center,
// nor the names of its contributors may be used to endorse or promote products
// derived from this Software without specific prior written permission.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
// SOFTWARE.

/* jshint esversion: 6 */

// TODO: add test for getting state
Expand Down Expand Up @@ -33,7 +66,7 @@ describe("Sync Server: Clients and Sockets", function (done) {
throw Error("An unexpected reconnect occurred.");
};

syncServer.disconnectedAction = function () {
syncServer.disconnectAction = function () {
throw Error("An unexpected disconnect occurred.");
};

Expand Down Expand Up @@ -102,7 +135,7 @@ describe("Sync Server: Clients and Sockets", function (done) {

let disconnectCount = 0;

syncServer.disconnectedAction = function (socket, session_id, client_id) {
syncServer.disconnectAction = function (socket, session_id, client_id) {
session_id.should.equal(SESSION_ID);

client_id.should.equal(CLIENT_ID);
Expand Down Expand Up @@ -166,7 +199,7 @@ describe("Sync Server: Clients and Sockets", function (done) {

let disconnectCount = 0;

syncServer.disconnectedAction = function (socket, session_id, client_id) {
syncServer.disconnectAction = function (socket, session_id, client_id) {
session_id.should.equal(SESSION_ID);

client_id.should.equal(CLIENT_ID);
Expand Down
Loading

0 comments on commit d5769cf

Please sign in to comment.