A handler for a given Connection

interface ConnectionHandler {
    onClose: undefined | ((connection: Remote<Connection>, reason?: any, c?: Remote<ConnectionHandler>) => PromiseVow<void>);
    onOpen: undefined | ((connection: Remote<Connection>, localAddr: string, remoteAddr: string, c: Remote<ConnectionHandler>) => PromiseVow<void>);
    onReceive: undefined | ((connection: Remote<Connection>, ack: string, c: Remote<ConnectionHandler>, opts?: Record<string, any>) => PromiseVow<string>);
}

Properties

onClose: undefined | ((connection: Remote<Connection>, reason?: any, c?: Remote<ConnectionHandler>) => PromiseVow<void>)

The connection has been closed

onOpen: undefined | ((connection: Remote<Connection>, localAddr: string, remoteAddr: string, c: Remote<ConnectionHandler>) => PromiseVow<void>)

The connection has been opened

onReceive: undefined | ((connection: Remote<Connection>, ack: string, c: Remote<ConnectionHandler>, opts?: Record<string, any>) => PromiseVow<string>)

The connection received a packet