Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
HTTP_PORT = 8181;
WSS_PORT = 8080;
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# dependencies
/node_modules
/dist

# System Files
.DS_Store
Thumbs.db
[Dd]esktop.ini

# Links
*.lnk
.idea/
*.PEM
.vscode/

# Logs
npm-debug.log
package-lock.json
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
# remote-control
# RSSchool NodeJS websocket task

# Description
Implemented on Typescript with the help of `nut.js` and `Jimp`. This app does the following:

* Starts websocket server
* Handles websocket connection
* Moves mouse (Up, Down, Left, Right)
* ~~Draw circle, rectangle and square~~ (IN PROGRESS)
* Sends current mouse coordinates
* Sends desktop capture

# Installation
1. Clone this repo `https://github.com/ITboo/remote-control.git`
2. Go to proper folder with `cd`
3. Install all the dependencies `npm install`
4. Run app with scripts
- `npm run start:dev` <--- development mode
- `npm run start` <--- production mode


1 change: 1 addition & 0 deletions front/assets/main.cf6861cdfa089d10cc44.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions front/assets/vendors.c1482dc05e9c6ace637b.js

Large diffs are not rendered by default.

51 changes: 51 additions & 0 deletions front/assets/vendors.c1482dc05e9c6ace637b.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/

/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/

/** @license React v0.19.1
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v16.13.1
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v16.13.1
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

//! moment.js

//! moment.js locale configuration
14 changes: 14 additions & 0 deletions front/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head><meta charset="UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1,maximum-scale=1,initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Remote control task</title>
</head>
<body>
<div id="root"></div>
<script src="/assets/vendors.c1482dc05e9c6ace637b.js">
</script>
<script src="/assets/main.cf6861cdfa089d10cc44.js"></script>
</body>
</html>
21 changes: 21 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { httpServer } from "./src/http_server/index";
import { WebSocketServer } from "ws";
import { wsConnection } from "./src/ws/handler";

const HTTP_PORT = 8181;
const WSS_PORT = 8080;

console.log(`Start static http server on the ${HTTP_PORT} port`);
httpServer.listen(HTTP_PORT);

// websocket соединение
const wss = new WebSocketServer({ port: WSS_PORT });
console.log(`Start Websocket server on the ${WSS_PORT} port`);
wss.on('connection', wsConnection);

process.on("SIGNINT", () => {
console.log("Websocket server is closed");
wss.close();
httpServer.close();
process.exit(0);
});
Loading