Comparing version 3.2.2 to 3.2.3
{ | ||
"name": "@kalm/udp", | ||
"version": "3.2.2", | ||
"version": "3.2.3", | ||
"description": "UDP transport for Kalm", | ||
@@ -5,0 +5,0 @@ "main": "bin/udp.js", |
175
types.d.ts
@@ -1,152 +0,35 @@ | ||
/* Types ---------------------------------------------------------------------*/ | ||
declare module '@kalm/udp' { | ||
interface UDPConfig { | ||
type?: string | ||
localAddr?: string | ||
reuseAddr?: boolean | ||
socketTimeout?: number | ||
connectTimeout?: number | ||
} | ||
interface EventHandler { | ||
(event?: any, event2?: any): void | ||
} | ||
interface KalmTransport { | ||
(params: any, emitter: NodeJS.EventEmitter): Socket | ||
} | ||
interface EventEmitter { | ||
on(type: string, handler: EventHandler): void | ||
off(type: string, handler?: EventHandler): void | ||
emit(type: string, evt?: any, evt2?: any): void | ||
removeAllListeners(type?: string): void | ||
listenerCount(type?: string): number | ||
} | ||
type Remote = { | ||
host: string | ||
port: number | ||
} | ||
interface ClientConfig { | ||
label?: string | ||
routine?: KalmRoutine | ||
json?: Boolean | ||
transport?: KalmTransport | ||
port?: number | ||
host?: string | ||
isServer?: boolean | ||
provider?: any | ||
} | ||
type SocketHandle = { | ||
socket: any | ||
port: number | ||
host: string | ||
} | ||
interface ProviderConfig { | ||
label?: string | ||
routine?: KalmRoutine | ||
json?: Boolean | ||
transport?: KalmTransport | ||
port?: number | ||
host?: string | ||
} | ||
interface Socket { | ||
bind: () => void | ||
remote: (handle: SocketHandle) => Remote | ||
connect: (handle?: SocketHandle) => SocketHandle | ||
stop: () => void | ||
send: (handle: SocketHandle, message: number[] | Buffer) => void | ||
disconnect: (handle: SocketHandle) => void | ||
} | ||
type Remote = { | ||
host: string | ||
port: number | ||
export default function udp(config?: UDPConfig): (config?: UDPConfig) => Transport; | ||
} | ||
interface Provider extends EventEmitter { | ||
broadcast: (channel: string, message: Serializable) => void | ||
label: string | ||
stop: () => void | ||
connections: Client[] | ||
} | ||
interface Client extends EventEmitter { | ||
write: (channel: string, message: Serializable) => void | ||
destroy: () => void | ||
subscribe: (channel: string, handler: (body: any, frame: Frame) => any) => void | ||
unsubscribe: (channel: string, handler: (body: any, frame: Frame) => any) => void | ||
local: () => Remote | ||
remote: () => Remote | ||
} | ||
type Channel = { | ||
queue: Queue | ||
emitter: EventEmitter | ||
} | ||
type ChannelList = { | ||
[key: string]: Channel | ||
} | ||
type Serializable = Buffer | object | string | null | ||
type UDPSocketHandle = { | ||
socket: any | ||
port: number | ||
host: string | ||
} | ||
type UDPClient = { | ||
client: Client | ||
timeout: NodeJS.Timeout | ||
data: Buffer[] | ||
} | ||
type UDPClientList = { | ||
[key: string]: UDPClient | ||
} | ||
type SocketHandle = NodeJS.Socket | UDPSocketHandle | WebSocket | ||
interface KalmRoutine { | ||
(channel: string, params: any, channelEmitter: EventEmitter, clientEmitter: EventEmitter): Queue | ||
} | ||
interface KalmRoutineParams { | ||
hz: number | ||
maxBytes: number | ||
seed: number | ||
} | ||
interface Queue { | ||
add: (packet: Buffer) => void | ||
size: () => number | ||
flush: () => void | ||
} | ||
interface KalmTransport { | ||
(params: any, emitter: EventEmitter): Socket | ||
} | ||
interface Socket { | ||
bind: () => void | ||
remote: (handle: SocketHandle) => Remote | ||
connect: (handle?: SocketHandle) => SocketHandle | ||
stop: () => void | ||
send: (handle: SocketHandle, message: number[] | Buffer) => void | ||
disconnect: (handle: SocketHandle) => void | ||
} | ||
interface IPCConfig { | ||
socketTimeout?: number | ||
path?: string | ||
} | ||
interface TCPConfig { | ||
socketTimeout?: number | ||
} | ||
interface UDPConfig { | ||
type?: string | ||
localAddr?: string | ||
reuseAddr?: boolean | ||
socketTimeout?: number | ||
connectTimeout?: number | ||
} | ||
interface WSConfig { | ||
cert?: string | ||
key?: string | ||
secure?: boolean | ||
} | ||
interface WebRTCConfig {} | ||
type RawFrame = { | ||
frameId: number | ||
channel: string | ||
packets: Buffer[] | ||
payloadBytes: number | ||
} | ||
type Frame = { | ||
client: Client | ||
channel: string | ||
frame: { | ||
id: number | ||
messageIndex: number | ||
payloadBytes: number | ||
payloadMessages: number | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6445
139