public async void SubscribeAll() { var a = (await client.OnJoin()).ResponseStream.ForEachAsync(x => OnJoin(x)); var b = (await client.OnLeave()).ResponseStream.ForEachAsync(x => OnLeave(x)); var c = (await client.OnMessageReceived()).ResponseStream.ForEachAsync(x => OnMessageReceived(x)); // TODO:Client side cancellation. await Task.WhenAll(a, b, c); }
static void SubscribeAllListner(IChatRoomStreaming client) { client.OnJoin(); client.OnLeave(); client.OnMessageReceived(); }