first commit

This commit is contained in:
sta
2010-10-18 22:28:56 +09:00
parent 67d3585285
commit 97c51bcc8f
31 changed files with 883 additions and 0 deletions

27
wsclient/AssemblyInfo.cs Normal file
View File

@@ -0,0 +1,27 @@
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("wsclient")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

Binary file not shown.

Binary file not shown.

BIN
wsclient/bin/Debug/wsclient.exe Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
wsclient/bin/Release/wsclient.exe Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

77
wsclient/wsclient.cs Normal file
View File

@@ -0,0 +1,77 @@
using Notifications;
using System;
using System.Threading;
using WebSocketSharp;
namespace Example
{
public class Program
{
public static void Main(string[] args)
{
//using (WebSocket ws = new WebSocket("ws://localhost:8000/"))
using (WebSocket ws = new WebSocket("ws://localhost:8000/", "chat"))
{
/*ws.OnOpen += (o, e) =>
{
//Do something.
};
*/
ws.OnMessage += (o, e) =>
{
#if LINUX
#if NOTIFY
ws.MsgNf.Summary = "[WebSocket] Message";
ws.MsgNf.Body = e;
ws.MsgNf.IconName = "notification-message-im";
ws.MsgNf.Show();
#else
Notification nf = new Notification("[WebSocket] Message",
e,
"notification-message-im");
nf.Show();
#endif
#else
Console.WriteLine(e);
#endif
};
ws.OnError += (o, e) =>
{
#if LINUX
Notification nf = new Notification("[WebSocket] Error",
e,
"notification-network-disconnected");
nf.Show();
#else
Console.WriteLine("Error: ", e);
#endif
};
/*ws.OnClose += (o, e) =>
{
//Do something.
};
*/
ws.Connect();
Thread.Sleep(500);
Console.WriteLine("\nType \"exit\" to exit.\n");
string data;
while (true)
{
Thread.Sleep(500);
Console.Write("> ");
data = Console.ReadLine();
if (data == "exit")
{
break;
}
ws.Send(data);
}
}
}
}
}

1
wsclient/wsclient.csproj Normal file
View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8"?>

BIN
wsclient/wsclient.pidb Normal file

Binary file not shown.