GithubHelp home page GithubHelp logo

sglass520 / react-socket-demo Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 541 KB

Socket.IO visualization with an Ionic React App and Express server

Home Page: https://stephen.glass

HTML 4.91% JavaScript 7.81% TypeScript 61.88% CSS 25.40%
ionic-framework react express socket-io

react-socket-demo's Introduction

Ionic React Socket.IO Demo

This project is an example for using Socket.IO with a React client app and an Express server. Ionic Framework is used as a boiler plate for client UI styling.

The user will be asked to create a username when accessing the app. After submitting, a circle will be created on the page with the username and the user will be connected to the server using sockets. The user can drag it's own circle around the canvas of the page. Circles from all clients are synced to the server and to every connected client.

drawing

Client Setup

Installation

Download Node.js

git clone https://github.com/sglass520/react-socket-demo.git
npm install -g @ionic/cli
npm install --save
ionic serve

Configuration

src/constants.ts

  • DEBUG: Enables verbose console logging
  • SOCKET_ENDPOINT*: Set to address and port of socket demo server

(*) required

Building

ionic build --prod

Server Setup

Installation

Download Node.js

git clone https://github.com/sglass520/react-socket-demo.git
cd server
npm install --save

Configuration

app.js

  • SSL_KEY*: File location of SSL private key file
  • SSL_CERT*: File location of SSL certificate file
  • ORIGINS*: List of trusted origins to allow socket connections from
  • PORT: Port to listen to for incoming socket connections (default: 4001)
  • INTERVAL_DATE: Frequency in milliseconds to update clients with server time
  • INTERVAL_CLIENTS: Frequency in milliseconds to update clients with synced client info

(*) required

Running

sudo node app.js

Running as Forever process

npm install -g forever
sudo forever forever.json

Notes

react-socket-demo's People

Contributors

sourcevg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.