SendChannelOperation









How do I use Send Channel Operation
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: ChatClient.cs Copy
217         public bool Subscribe(string[] channels, int messagesFromHistory)
218         {
219             if (!this.CanChat)
220             {
221                 // TODO: log error
222                 return false;
223             }
224
225             if (channels == null || channels.Length == 0)
226             {
227                 this.LogWarning("Subscribe can't be called for empty or null cannels-list.");
228                 return false;
229             }
230
231             return this.SendChannelOperation(channels, (byte)ChatOperationCode.Subscribe, messagesFromHistory);
232         }
File name: ChatClient.cs Copy
245         public bool Unsubscribe(string[] channels)
246         {
247             if (!this.CanChat)
248             {
249                 // TODO: log error
250                 return false;
251             }
252
253             if (channels == null || channels.Length == 0)
254             {
255                 this.LogWarning("Unsubscribe can't be called for empty or null cannels-list.");
256                 return false;
257             }
258
259             return SendChannelOperation(channels, ChatOperationCode.Unsubscribe, 0);
260         }
File name: ChatClient.cs Copy
676         private bool SendChannelOperation(string[] channels, byte operation, int historyLength)
677         {
678             Dictionary opParameters = new Dictionary { { (byte)ChatParameterCode.Channels, channels } };
679
680             if (historyLength != 0)
681             {
682                 opParameters.Add((byte)ChatParameterCode.HistoryLength, historyLength);
683             }
684
685             return this.chatPeer.OpCustom(operation, opParameters, true);
686         }

SendChannelOperation 125 lượt xem

Gõ tìm kiếm nhanh...