Skip to content

Instantly share code, notes, and snippets.

@GeorgeTsiokos
Created June 30, 2017 11:56
Show Gist options
  • Save GeorgeTsiokos/c7966899c1e04236f0130f3613ed8dec to your computer and use it in GitHub Desktop.
Save GeorgeTsiokos/c7966899c1e04236f0130f3613ed8dec to your computer and use it in GitHub Desktop.
Lightstreamer .NET metadata adapter for authentication
internal class TestProvider : LiteralBasedProvider
{
public override void NotifyUser(string user, string password)
{
Console.WriteLine($"NotifyUser {user} {password}");
if (false)
throw new AccessException("Unauthorized user");
}
}
internal class Program
{
static void Main(string[] args) { MainAsync().Wait(); }
static async Task MainAsync()
{
var host = "localhost";
var requestReplyPort = 6660;
var requestReply = new TcpClient();
var connectRequestReply = requestReply.ConnectAsync(host, requestReplyPort);
await connectRequestReply;
var requestReplyStream = requestReply.GetStream();
var dataProviderServer = new MetadataProviderServer
{
RequestStream = requestReplyStream,
ReplyStream = requestReplyStream,
Adapter = new TestProvider()
};
dataProviderServer.Start();
Console.WriteLine("Started...");
Console.ReadLine();
}
}
@yzorg
Copy link

yzorg commented Jun 30, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment