first commit
This commit is contained in:
27
wsclient/AssemblyInfo.cs
Normal file
27
wsclient/AssemblyInfo.cs
Normal 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("")]
|
||||
|
BIN
wsclient/bin/Debug/websocket-sharp.dll
Executable file
BIN
wsclient/bin/Debug/websocket-sharp.dll
Executable file
Binary file not shown.
BIN
wsclient/bin/Debug/websocket-sharp.dll.mdb
Normal file
BIN
wsclient/bin/Debug/websocket-sharp.dll.mdb
Normal file
Binary file not shown.
BIN
wsclient/bin/Debug/wsclient.exe
Executable file
BIN
wsclient/bin/Debug/wsclient.exe
Executable file
Binary file not shown.
BIN
wsclient/bin/Debug/wsclient.exe.mdb
Normal file
BIN
wsclient/bin/Debug/wsclient.exe.mdb
Normal file
Binary file not shown.
BIN
wsclient/bin/Debug_Ubuntu/websocket-sharp.dll
Executable file
BIN
wsclient/bin/Debug_Ubuntu/websocket-sharp.dll
Executable file
Binary file not shown.
BIN
wsclient/bin/Debug_Ubuntu/websocket-sharp.dll.mdb
Normal file
BIN
wsclient/bin/Debug_Ubuntu/websocket-sharp.dll.mdb
Normal file
Binary file not shown.
BIN
wsclient/bin/Debug_Ubuntu/wsclient.exe
Executable file
BIN
wsclient/bin/Debug_Ubuntu/wsclient.exe
Executable file
Binary file not shown.
BIN
wsclient/bin/Debug_Ubuntu/wsclient.exe.mdb
Normal file
BIN
wsclient/bin/Debug_Ubuntu/wsclient.exe.mdb
Normal file
Binary file not shown.
BIN
wsclient/bin/Release/websocket-sharp.dll
Executable file
BIN
wsclient/bin/Release/websocket-sharp.dll
Executable file
Binary file not shown.
BIN
wsclient/bin/Release/wsclient.exe
Executable file
BIN
wsclient/bin/Release/wsclient.exe
Executable file
Binary file not shown.
BIN
wsclient/bin/Release_Ubuntu/websocket-sharp.dll
Executable file
BIN
wsclient/bin/Release_Ubuntu/websocket-sharp.dll
Executable file
Binary file not shown.
BIN
wsclient/bin/Release_Ubuntu/wsclient.exe
Executable file
BIN
wsclient/bin/Release_Ubuntu/wsclient.exe
Executable file
Binary file not shown.
77
wsclient/wsclient.cs
Normal file
77
wsclient/wsclient.cs
Normal 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
1
wsclient/wsclient.csproj
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
BIN
wsclient/wsclient.pidb
Normal file
BIN
wsclient/wsclient.pidb
Normal file
Binary file not shown.
Reference in New Issue
Block a user