Skip to content

htar/rs-school-node-remote-control

 
 

Repository files navigation

RSSchool NodeJS websocket task template

Static http server and base task packages.

Installation

  1. Clone/download repo
  2. npm install

Usage

Development

npm run start:dev

  • App served @ http://localhost:8181 with nodemon

Production

npm run start

  • App served @ http://localhost:8181 without nodemon

All commands

Command Description
npm run dev App served @ http://localhost:8181 with nodemon
npm run start App served @ http://localhost:8181 without nodemon

Note: replace npm with yarn in package.json if you use yarn.

Assignment: Websocket Remote Control

Description

Your task is to implement remote control backend using RobotJS library and websocket.

User interface for your remote control backend is here

The backend should be able to do the following:

  • Start websocket server
  • Handle websocket connection
  • Move mouse (Up, Down, Left, Right)
  • Draw circle, rectangle and square
  • Send current mouse coordinates
  • Send desktop capture (optionally)

Technical requirements

  • Task can be implemented on Javascript or Typescript
  • Use 16 LTS version of Node.js
  • Only ws, robotjs, jimp, cross-env, typescript, ts-node, ts-node-dev, nodemon, dotenv, eslint and its plugins, webpack and its plugins, prettier, @types/* and testing tools (for example, Jest, Mocha, AVA, Jasmine, Cypress, Storybook, Puppeteer) are allowed
  • The program is started by npm script start in following way:
npm run start 
  • After starting the program displays websocket parameters
  • After program work finished the program should end websocket work correctly
  • After each received command program should display the command and result
  • All commands should be ended with \0

List of websocket commands and their syntax (<- - cmd from frontend, -> - answer):

  • Navigation over the x and y axis
    • Move mouse up
    <- mouse_up {y px}
    • Move mouse down
    <- mouse_down {y px}
    • Move mouse left
    <- mouse_left {x px}
    • Move mouse right
    <- mouse_right {x px}
    • Send mouse coordinates
    <- mouse_position
    -> mouse_position {x px},{y px}
  • Drawing
    • Draw circle with pushed left button:
    <- draw_circle {px}
    • Draw rectangle with pushed left button:
    <- draw_rectangle {px} {px}
    • Draw square with pushed left button:
    <- draw_square {px}
  • Print screen
    • Make print screen command and send image (a base64 buffer of the 200 px square around the mouse position):
    <- prnt_scrn
    -> prnt_scrn {base64 string (png buf)}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 93.0%
  • HTML 6.6%
  • Shell 0.4%