githubEdit

tower-cellReal-Time Connection (Socket.IO)

PxServ supports real-time bidirectional communication via Socket.IO. Authenticate using your project API key and listen for data events as they occur.

The examples below use JavaScript/TypeScript. The same event structure and API key authentication apply to any language with a Socket.IO client (Python, Rust, Go, Java, etc.).

Connecting

const socket = io("https://api.pxserv.net", {
  auth: {
    apiKey: "your_project_api_key",
  },
});

socket.on("connect", () => {
  console.log("Connected to PxServ.");
});

Events

setData — Data Updated

Emitted when a key-value pair is saved or updated.

socket.on("setData", (data) => {
  console.log("Data updated:", data);
});

Example payload:


removeData — Data Removed

Emitted when a key is deleted.

Example payload:


Disconnecting

Other Languages

Last updated