Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth without port #53

Open
gowthamnatarajan opened this issue May 17, 2024 · 1 comment
Open

Auth without port #53

gowthamnatarajan opened this issue May 17, 2024 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@gowthamnatarajan
Copy link

My Broker has provided me with the link to connect and it does not have a port.
Its something like wss://abc.dxfeed.com/realtime

How do I authenticate with a token?

@stdcion
Copy link
Collaborator

stdcion commented May 21, 2024

Hello @gowthamnatarajan

Most likely you're connecting to dxLink. For token-based authorization, use the following address format: "dxlink:wss://demo.dxfeed.com/dxlink-ws[login=dxlink:token]"

Here's an example of how to do it:

using System;
using DxFeed.Graal.Net;
using DxFeed.Graal.Net.Api;
using DxFeed.Graal.Net.Events.Market;

// Enable experimental feature.
SystemProperty.SetProperty("dxfeed.experimental.dxlink.enable", "true");
// Set scheme for dxLink.
SystemProperty.SetProperty("scheme", "ext:opt:sysprops,resource:dxlink.xml");

// For token-based authorization, use the following address format:
// "dxlink:wss://demo.dxfeed.com/dxlink-ws[login=dxlink:token]"
using var endpoint = DXEndpoint.Create().Connect("dxlink:wss://demo.dxfeed.com/dxlink-ws");
using var subscription = endpoint.GetFeed().CreateSubscription(typeof(Quote));
subscription.AddEventListener(events =>
{
    foreach (var e in events)
    {
        Console.WriteLine(e);
    }
});
subscription.AddSymbols("AAPL");
Console.ReadKey();

@stdcion stdcion self-assigned this May 21, 2024
@stdcion stdcion added the question Further information is requested label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants