# Simplist way to have a high score server across multiple locations?

**URL:** <https://discourse.processing.org/t/simplist-way-to-have-a-high-score-server-across-multiple-locations/40957>\
**Category:** Project Guidance\
**Created:** [February 18, 2023, 10:46pm UTC](https://discourse.processing.org/t/simplist-way-to-have-a-high-score-server-across-multiple-locations/40957 "2023-02-18T22:46:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![EliTheIceMan](https://avatars.discourse-cdn.com/v4/letter/e/d26b3c/32.png) [@EliTheIceMan](https://discourse.processing.org/u/EliTheIceMan)\
**Post date:** [February 18, 2023, 10:46pm UTC](https://discourse.processing.org/t/simplist-way-to-have-a-high-score-server-across-multiple-locations/40957/1 "2023-02-18T22:46:39Z")

</div>

I feel I am pretty competent with Processing (java) but have no experience with servers and the like. What would be the best/easiest way to implement a “server/broker” that could allow multiple instances of a sketch simultaneously running in various locations around the country to have a synchronized high score list?

I know there are lots of way to accomplish this but the only one that I can think of would be to use the network library, link the client machines through a VPN like ZeroTierOne, and run a separate server sketch that can parse and compare the incoming scores. I have not tested it but it sounds doable. Thinking 100 clients max.  
Thanks!

---

<div class="post-metadata">

**Author:** ![PerryJohnson](https://avatars.discourse-cdn.com/v4/letter/p/57b2e6/32.png) [@PerryJohnson](https://discourse.processing.org/u/PerryJohnson)\
**Post date:** [February 19, 2023, 4:23am UTC](https://discourse.processing.org/t/simplist-way-to-have-a-high-score-server-across-multiple-locations/40957/2 "2023-02-19T04:23:00Z")

</div>

I’m writing a drawing application in Processing and connect instances to a central server running a PHP/SQLite database using the contributed library, HTTP Requests for Processing. It’s pretty simple to send POST or GET (html form or query string style) data from Processing. PHP is what I chose but it could be Python, Perl, or even Java. Most web hosting platforms can handle a multitude of languages.

---

<div class="post-metadata">

**Author:** ![iaido42](https://avatars.discourse-cdn.com/v4/letter/i/977dab/32.png) [@iaido42](https://discourse.processing.org/u/iaido42)\
**Post date:** [February 19, 2023, 11:52am UTC](https://discourse.processing.org/t/simplist-way-to-have-a-high-score-server-across-multiple-locations/40957/3 "2023-02-19T11:52:43Z")

</div>

one solution: [Network / Libraries / Processing.org](https://processing.org/reference/libraries/net/index.html)

or my favorite  
node.js with express.js and [socket.io](http://socket.io)

Full example: [GitHub - iaido42/nodeTest\_p5Js: simple client/server with for p5js with node.js, express.js and socket.io](https://github.com/iaido42/nodeTest_p5Js.git)

[Socken.io](http://Socken.io) is a library and protocol based an WebSocket (only for the first connect) but is faster  
simple Server example server.js :  
var express = require(“express”);  
// express app instance  
var app = express();  
// server  
var server = app.listen(3000);  
// static files  
app.use(express.static(“public”));  
// [socket.io](http://socket.io) instance  
var socket = require(“[socket.io](http://socket.io)”);  
var io = socket(server);  
// new connection event  
io.sockets.on(“connection”, newConnection);  
function newConnection(socket) {  
console.log(“new connection” + socket.id);  
console.log(socket.id);  
// mouse event listener  
socket.on(“mouse”, mouseMsg);  
function mouseMsg(data) {  
// broadcast to all clients  
socket.broadcast.emit(“mouse”, data);  
console.log(data);  
}  
}

Install and first steps [Socket.IO](http://Socket.IO) with Node.Js + Express:  
[https://medium.com/kocfinanstech/socket-io-with-node-js-express-5cc75aa67cae](https://medium.com/kocfinanstech/socket-io-with-node-js-express-5cc75aa67cae)

Client [Socket.io](http://Socket.io) Software for Java  
[GitHub - socketio/socket.io-client-java: Full-featured Socket.IO Client Library for Java, which is compatible with Socket.IO v1.0 and later.](https://github.com/socketio/socket.io-client-java)

very useful (p5js):

# 12.3: Connecting Client to Server with [Socket.io](http://Socket.io) - WebSockets and p5.js Tutorial

[![](https://i.ytimg.com/vi/HZWmrt3Jy10/hqdefault.jpg "12.3: Connecting Client to Server with Socket.io - WebSockets and p5.js Tutorial") ](https://www.youtube.com/watch?v=HZWmrt3Jy10)
