UNPKG

local-connect

Version:

Create a connection between all your app on the same network

26 lines (22 loc) 868 B
import { EventEmitter } from 'events'; import { Server as HttpServer } from 'http'; import { Server as SocketIOServer, Socket } from 'socket.io'; declare class Connection { constructor(socket: Socket, id: string, ip: string); } declare class LocalConnection extends EventEmitter { constructor(id: string, port?: number); port: number; id: string; connections: Map<string, Connection>; server: HttpServer; uuid: string; io: SocketIOServer; scan(): this; on(event: '', listener: (...args: []) => void): this; on(event: 'listen', listener: () => void): this; on(event: 'scan_finish', listener: () => void): this; on(event: 'connection', listener: (socket: Socket) => void): this; on(event: 'scanning', listener: (index: number, size: number) => void): this; } export { LocalConnection};