Skip to content

Home > @esengine/ecs-framework-monorepo > ITransport

ITransport interface

传输层抽象接口

Signature:

typescript
export interface ITransport

Methods

Method

Description

broadcast(data, exclude)

广播数据到所有客户端

disconnectClient(clientId, reason)

断开指定客户端

getClientCount()

获取连接的客户端数量

isClientConnected(clientId)

检查客户端是否连接

onConnect(handler)

监听客户端连接事件

onDisconnect(handler)

监听客户端断开事件

onError(handler)

监听错误事件

onMessage(handler)

监听消息接收事件

send(clientId, data)

发送数据到指定客户端

start(port, host)

启动传输层

stop()

停止传输层

基于 MIT 许可证发布