Tick Detector API Documentation

HTTP API

GET /api/tick

Returns the latest detected tick time as a JSON string.

curl https://tick.edcd.io/api/tick
"2026-08-02T08:03:10+00:00"

The response is an ISO 8601 timestamp in UTC.

GET /api/ticks

Returns historical tick times as a JSON array of objects.

curl https://tick.edcd.io/api/ticks?start=2026-07-01&end=2026-07-31

Response:

[{"TIME":"2026-07-01T07:29:36+00:00"},{"TIME":"2026-07-02T09:52:57+00:00"}, ...]
ParameterFormatDefaultDescription
startYYYY-MM-DD2014-12-16Start date (inclusive)
endYYYY-MM-DDTodayEnd date (inclusive)

WebSocket API (Socket.IO)

The tick detector provides a real-time WebSocket interface using Socket.IO. Clients receive the latest tick on connection and are notified immediately when a new tick is detected.

Socket.IO v4 Required
This server uses Socket.IO protocol v4 (Engine.IO v4). Clients using older versions of socket.io-client (v2.x or earlier) will receive HTTP 400 errors when attempting to connect.

If you are seeing EIO=3 in your connection URL or getting 400 responses, you need to upgrade your client library.

Compatible Client Versions

LanguageLibraryMinimum Version
JavaScript/Node.jssocket.io-client4.0.0+
Pythonpython-socketio[client]5.0.0+
Javasocket.io-client-java2.0.0+
C#SocketIOClient3.0.0+

Connection

Connect to the WebSocket at the base URL:

const { io } = require("socket.io-client");
// socket.io-client v4.x
const socket = io("https://tick.edcd.io/");

Events

EventDirectionWhenPayload
message Server → Client On connect, and when a new tick is detected ISO 8601 timestamp string
tick Server → Client Only when a new tick is detected ISO 8601 timestamp string
Tip: The message event fires both on initial connection (with the current latest tick) and on new tick detection. The tick event only fires for new detections, making it useful for triggering alerts without handling the initial connection message separately.

Node.js Example (v4 client)

const { io } = require("socket.io-client");

const socket = io("https://tick.edcd.io/", {
    transports: ["websocket", "polling"]
});

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

socket.on("message", (data) => {
    console.log("Latest tick:", data);
});

socket.on("tick", (data) => {
    console.log("NEW TICK DETECTED:", data);
});

socket.on("connect_error", (error) => {
    console.error("Connection error:", error.message);
});

Python Example

import socketio

sio = socketio.Client()

@sio.on("message")
def on_message(data):
    print(f"Latest tick: {data}")

@sio.on("tick")
def on_tick(data):
    print(f"NEW TICK DETECTED: {data}")

sio.connect("https://tick.edcd.io/")
sio.wait()

Upgrading from Socket.IO v2

If you were previously connected to this service using socket.io-client v2.x, the migration is straightforward:

  1. Update your dependency: npm install socket.io-client@4
  2. Change the import (if using ES modules):
    // Old (v2)
    const io = require("socket.io-client");
    const socket = io("https://tick.edcd.io/");
    
    // New (v4)
    const { io } = require("socket.io-client");
    const socket = io("https://tick.edcd.io/");
  3. The event names and payload format are unchanged. No other code changes are required.
Why the change? The previous Node.js service used Socket.IO v2. The replacement Python service uses Socket.IO protocol v4, which is not backwards-compatible at the protocol level. The v4 protocol improves connection reliability, has better error handling, and supports binary data more efficiently.

Polling Alternative

If you prefer not to use WebSockets, you can poll the HTTP API instead. The tick typically occurs once or twice per day, so polling /api/tick every 60 seconds is perfectly adequate:

// Simple polling alternative
setInterval(async () => {
    const resp = await fetch("https://tick.edcd.io/api/tick");
    const tick = await resp.json();
    // Compare with your stored value to detect changes
}, 60000);

Tick Detector service maintained by the EDCD community. Source: GitHub