websocket-sharp/Example1/Program.cs

38 lines
845 B
C#
Raw Normal View History

2012-07-31 09:36:52 +08:00
using System;
using System.Threading;
2012-08-06 13:34:39 +08:00
namespace Example1
2012-07-31 09:36:52 +08:00
{
public class Program
{
2014-10-02 15:16:15 +08:00
public static void Main (string[] args)
2012-07-31 09:36:52 +08:00
{
2016-08-06 16:18:57 +08:00
// The AudioStreamer class provides a client (chat) for AudioStreamer
// (https://github.com/agektmr/AudioStreamer).
2016-07-31 16:02:25 +08:00
using (var streamer = new AudioStreamer ("ws://localhost:3000/socket"))
2012-07-31 09:36:52 +08:00
{
2014-03-13 15:08:28 +08:00
string name;
do {
Console.Write ("Input your name> ");
name = Console.ReadLine ();
}
while (name.Length == 0);
streamer.Connect (name);
2014-03-30 15:04:08 +08:00
Console.WriteLine ("\nType 'exit' to exit.\n");
2014-03-12 19:23:37 +08:00
while (true) {
2014-03-16 03:25:19 +08:00
Thread.Sleep (1000);
2014-03-12 19:23:37 +08:00
Console.Write ("> ");
var msg = Console.ReadLine ();
if (msg == "exit")
2012-07-31 09:36:52 +08:00
break;
2014-03-12 19:23:37 +08:00
streamer.Write (msg);
2012-07-31 09:36:52 +08:00
}
}
}
}
}