UNPKG

@citrineos/util

Version:

The OCPP util module which supplies helpful utilities like cache and queue connectors, etc.

25 lines 803 B
// SPDX-FileCopyrightText: 2025 Contributors to the CitrineOS Project // // SPDX-License-Identifier: Apache-2.0 import { Duplex } from 'stream'; export class UpgradeAuthenticationError extends Error { constructor(message) { super(message); this.name = 'UpgradeAuthenticationError'; } terminateConnection(socket) { try { socket.write('HTTP/1.1 401 Unauthorized\r\n'); socket.write('WWW-Authenticate: Basic realm="Access to the WebSocket", charset="UTF-8"\r\n'); socket.write('\r\n'); socket.end(); socket.destroy(); return true; } catch (error) { this.message = error.message; return false; } } } //# sourceMappingURL=AuthenticationError.js.map