UNPKG

@munit-solutions/ocpp

Version:
24 lines (23 loc) 841 B
/// <reference types="node" /> import WebSocket, { Server, ServerOptions } from 'ws'; import ClientCommand from '../enum/ClientCommand'; import { EventEmitter } from 'events'; import Message from '../builder/Message'; export declare type WSParams = { id?: string; connectorId?: number; }; export default class OCPPServer extends EventEmitter { ws: Server; constructor(options?: ServerOptions, callback?: () => void); on(event: ClientCommand | 'context_error' | string, listener: (this: OCPPServer, { ws, params, msg }: { ws: WebSocket; params: WSParams; msg: Message; }) => void): this; once(event: ClientCommand | 'context_error' | string, listener: (this: OCPPServer, { ws, params, msg }: { ws: WebSocket; params: WSParams; msg: Message; }) => void): this; }