Created
June 30, 2017 11:56
-
-
Save GeorgeTsiokos/c7966899c1e04236f0130f3613ed8dec to your computer and use it in GitHub Desktop.
Lightstreamer .NET metadata adapter for authentication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Related browser client (HTML/JS): https://github.com/Lightstreamer/Lightstreamer-example-AuthMetadata-client-javascript/blob/master/src/index.js