Skip to content

Instantly share code, notes, and snippets.

@Odonno
Created May 4, 2020 19:02
Show Gist options
  • Save Odonno/f9e596f627083b21a6dbdef9d798068f to your computer and use it in GitHub Desktop.
Save Odonno/f9e596f627083b21a6dbdef9d798068f to your computer and use it in GitHub Desktop.
ServerToClient.Basic.cs
// Basic implementation of server-to-client
public ChannelReader<Weather> RealtimeWeather()
{
var channel = Channel.CreateUnbounded<Weather>();
_ = WriteItemsAsync(channel.Writer, count, delay);
return channel.Reader;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment