let secret; function preload() { const socket = io(); // client-side socket.on("connect", () => { console.log(socket.id); // x8WIv7-mJelg7on_ALbx socket.on("hello", (arg) => { //console.log(arg) secret = arg; console.log(secret) }); }); } function setup() { createCanvas(400, 400); } function draw() { background(220); textSize(32); text(secret, 10, 30); }