-
Notifications
You must be signed in to change notification settings - Fork 3
Client
George Michaelides edited this page Mar 25, 2015
·
24 revisions
###Connect to a server
var client = new GemClient( Profile: "GemChat"
ServerName: "GemServer" ,
IP: "127.0.0.1",
Port: 14242);
client.RunAsync(() => new ConnectionApprovalMessage
{
Message = "Incoming client",
Sender = "Example",
Password = "1234"
});
###Execute a console command
//The commands' output
GemNetworkDebugger.Echo = Console.WriteLine;
string command = "echo This is a test";
GemClient.SendCommand(commmand);
###Notify the server
GemClient.SendNotification("what's up?");
###Send Messages via Network Package
Simply by decorationg your POCO class with the `NetworkPackage("profile") attribute
More info about network packages
###Lightweight Network Outgoing Messages
INetworkEvent sayEvent;
void SetupNetworkEvent()
{
sayEvent = GemClient.Profile("GemChat")
.CreateNetworkEvent
.HandleWith(this, x => new Action<string,string>(x.Say));
}
public void Say(string name, string message)
{
Console.WriteLine(String.Format("{0} : {1}",name,message);
sayEvent.Send(name,message).
}
###Abstract Network Message Flow