├── server ├── .env.sample ├── README.md ├── index.js └── package.json ├── README.md └── .gitignore /server/.env.sample: -------------------------------------------------------------------------------- 1 | PORT=8080 -------------------------------------------------------------------------------- /server/README.md: -------------------------------------------------------------------------------- 1 | # Ping WebSocket Server 2 | 3 | Install all dependencies 4 | ``` 5 | npm install 6 | ``` 7 | 8 | Start the server 9 | ``` 10 | node index.js 11 | ``` 12 | 13 | Check this [Wiki guide](https://github.com/calvinalx/ping/wiki/Installing-the-WebSocket-Ping-Server) on how to get your Ping server up and running. 14 | -------------------------------------------------------------------------------- /server/index.js: -------------------------------------------------------------------------------- 1 | const WebSocket = require("ws") 2 | 3 | const port = process.env.PORT || 8080 4 | const wss = new WebSocket.Server({ port }) 5 | 6 | wss.on("connection", (ws) => { 7 | ws.on("message", () => { 8 | ws.send("Pong") 9 | }) 10 | 11 | ws.send("Connected to Ping") 12 | }) 13 | 14 | console.log(`WebSocket started at port ${port}.`) 15 | -------------------------------------------------------------------------------- /server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ping-server", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "dependencies": { 12 | "express": "^4.17.1", 13 | "ws": "^7.2.5" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Ping](https://i.imgur.com/0S4Kp6g.png) 2 | 3 | Ping is a latency measurement App that works directly in your web browser. Currently at the moment there is 2 reliable way to do this, using HTTP Fetch and WebSocket. 4 | 5 | You can try the App here: https://ping.calvin.al 6 | 7 | ## Getting Started 8 | - [Installing the WebSocket Ping Server](https://github.com/calvinalx/ping/wiki/Installing-the-WebSocket-Ping-Server) 9 | - If you want to host it yourself, grab the [latest release](https://github.com/calvinalx/ping/releases) and then [follow this guide](https://create-react-app.dev/docs/deployment/) for deployment 10 | 11 | ## Source Code 12 | - Source code for the React client app will be available soon, It's currently a mess, making it unsuitable for public viewing. 13 | - [Geodata Lookup API](https://github.com/calvinalx/geoloc) 14 | 15 | ## Features 16 | - Measure latency with HTTP/WebSocket 17 | - Real-time Charts 18 | - World Maps 19 | - Geolocation Data 20 | - Change server modals 21 | - Share button 22 | - Dark Mode 🆕 23 | 24 | ## Planned Features 25 | - Code Refactoring (Yes, the code is a mess right now) 26 | - Show/hide chart toggle 27 | - Better Geolocation data, ability to switch between Origin and Destination 28 | - Ping Multiple servers at once 29 | - Global Latency page / Server browser (Will need servers from all around the world 😮) 30 | - Electron App (ICMP support with Node.js) 31 | - Change charts timeframe (5 and 10 minutes or possibly longer) 32 | 33 | ## Why this was made? 34 | Since the Covid-19 outbreak, I have found my internet connection very unstable, therefore this led me to open Command Prompt all the time doing something like `ping -t google.com` to see how its currently doing. 35 | And I tried finding some ping test site but none of them had a real-time graph or something like that, so I made this 😁 36 | 37 | ## Support 38 | - [Donate](https://bit.ly/ZDonate) 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # Snowpack dependency directory (https://snowpack.dev/) 45 | web_modules/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | .parcel-cache 78 | 79 | # Next.js build output 80 | .next 81 | out 82 | 83 | # Nuxt.js build / generate output 84 | .nuxt 85 | dist 86 | 87 | # Gatsby files 88 | .cache/ 89 | # Comment in the public line in if your project uses Gatsby and not Next.js 90 | # https://nextjs.org/blog/next-9-1#public-directory-support 91 | # public 92 | 93 | # vuepress build output 94 | .vuepress/dist 95 | 96 | # Serverless directories 97 | .serverless/ 98 | 99 | # FuseBox cache 100 | .fusebox/ 101 | 102 | # DynamoDB Local files 103 | .dynamodb/ 104 | 105 | # TernJS port file 106 | .tern-port 107 | 108 | # Stores VSCode versions used for testing VSCode extensions 109 | .vscode-test 110 | 111 | # yarn v2 112 | 113 | .yarn/cache 114 | .yarn/unplugged 115 | .yarn/build-state.yml 116 | .pnp.* 117 | 118 | .netlify 119 | build --------------------------------------------------------------------------------