/websockets-example

An example of websockets using Socket.io

Primary LanguageJavaScript

How To Run

Websockets Example

On a local NodeJS server:

  1. Move all files to NodeJS's working directory
  2. Initialize the project and install its dependencies:
npm install
  1. Start the server:
node index
  1. Go to http://localhost:4000

In a Docker container:

  1. Create a Docker container from the node image (adding your own local path):
docker run -it --rm --name websockets \
  -p 4000:4000 \
  -v /path/to/local/files:/usr/src/app \
  -w /usr/src/app \
  node
  1. Start an interactive bash shell in the container:
docker exec -it websockets bash
  1. Initialize the project and install its dependencies:
npm install
  1. Start the server:
node index
  1. Go to http://localhost:4000