public static Action GetOrCreateChannel (string channelName, Action<int,byte[]> handler);

Parameters

channelNameThe name of the channel to retrieve.
handlerThe channel handler to register.

Returns

Action This action can be invoked to unregister the handler from the channel (see ChannelService.UnregisterMessageHandler).

Description

Gets or creates a new channel.

When you create a channel, the ChannelService listens to connections on it, and routes all messages sent to it. You have to register a handler to process the messages and send them back to other clients."

If a channel with the same name already exists, it appends the handler to its list of handlers. This allows you to log or listen to all messages sent to a specific channel.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961