first commit
This commit is contained in:
@@ -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("")]
|
||||
|
||||
Executable
BIN
Binary file not shown.
Binary file not shown.
Executable
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Executable
BIN
Binary file not shown.
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
Binary file not shown.
Reference in New Issue
Block a user