feat: refactor Python SDK and enhance API error reporting
- Relocated Python SDK to `sdk/python/datastack` with new auto-configuration support via `config.datastack.py` - Updated SDK installation and usage documentation - Enhanced `/api/events` response format to include specific error codes for revoked and rotated credentials - Updated SDK dashboard snippet generator to support new configuration pattern
This commit is contained in:
1 parent
367dd819f8
commit
0c2e49cd47
18 files changed
+2288
-249
No files matched your search
@@ -307,6 +307,47 @@ function setupSocketHandlers(io, bufferQueue, worker, options = {}) {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Heartbeat & Reconnection Verification Event
|
||||
socket.on("ping_verify", async (_payload, callback) => {
|
||||
try {
|
||||
const dbCheck = await verifyClientInDb(
|
||||
clientId,
|
||||
socket.data.token,
|
||||
true,
|
||||
);
|
||||
if (!dbCheck.allowed) {
|
||||
if (callback) {
|
||||
callback({
|
||||
success: false,
|
||||
status: "REVOKED",
|
||||
error: dbCheck.reason || "CLIENT_REVOKED",
|
||||
});
|
||||
}
|
||||
socket.disconnect(true);
|
||||
return;
|
||||
}
|
||||
const config = getRuntimeConfig();
|
||||
if (callback) {
|
||||
callback({
|
||||
success: true,
|
||||
status: "VERIFIED",
|
||||
clientId,
|
||||
rateLimit: dbCheck.rateLimit || socket.data.rateLimit || 100,
|
||||
maxPayloadSizeBytes: config.maxPayloadSizeBytes,
|
||||
serverTime: new Date().toISOString(),
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
if (callback) {
|
||||
callback({
|
||||
success: false,
|
||||
status: "ERROR",
|
||||
error: err.message,
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user