格式
typescript
NetServer.EmitAndBroadcast(type, args)所属类: NetServer
描述
发送消息并广播到所有连接的客户端。
参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| type | Contract | 派生于Contract的对象 |
| args | Parameters | 参数 |
返回值
| 类型 | 描述 |
|---|---|
void |
代码示例
typeScript
class TestRequest extends Contract{
Exescute(msg: string): void {
Debug.Log("client send :: ", msg);
}
Receive(msg: string): void {
Debug.Log("client receive :: ", msg);
NetServer.EmitAndBroadcast(TestRequest, msg);
}
}