How to login to the streaming api c#

2 posts / 0 new
Last post
How to login to the streaming api c#

Hi There,

I'm a bit stuck, I was able to login with the REST Api, and I manage to obtain the CST and the XST tokens, so I have the password, has my username but I can't seems to able to connect to the streaming server:

password = "CST-" + CST + "|" + "XST-" + Token;

ConnectionInfo connInfo = new ConnectionInfo();
connInfo.User = username;
connInfo.Password = password;

connInfo.PushServerUrl = ""

LSClient myClient = new LSClient();
var req = new Lightstreamer.DotNet.Client.adapter.TestConnection();

myClient.OpenConnection(connInfo, req);

Port 8080 where the Lightstreamer HTTP server is listening, and if I try to run the code above I will get the following error message:
A STREAM error occurred: 'Lightstreamer.DotNet.Client.PushConnException: The rem
ote server returned an error: (403) Forbidden. ---> System.Net.WebException: The
remote server returned an error: (403) Forbidden.
at Lightstreamer.DotNet.Client.HttpProvider.DoHTTP(Boolean isPost) in c:\LIGH
TSTREAMER\LS_SDK_client_dotnet\tmp_src\Source\HttpProvider.cs:line 570
at Lightstreamer.DotNet.Client.HttpProvider.DoHTTP(IDictionary parameters, Bo
olean isPost) in c:\LIGHTSTREAMER\LS_SDK_client_dotnet\tmp_src\Source\HttpProvid
er.cs:line 491
at Lightstreamer.DotNet.Client.PushServerTranslator.CallSession() in c:\LIGHT
STREAMER\LS_SDK_client_dotnet\tmp_src\Source\PushServerTranslator.cs:line 139
at Lightstreamer.DotNet.Client.PushServerProxy.ConnectForSession() in c:\LIGH
TSTREAMER\LS_SDK_client_dotnet\tmp_src\Source\PushServerProxy.cs:line 166
--- End of inner exception stack trace ---
at Lightstreamer.DotNet.Client.ExtConnectionListener.WaitStreamingTimeoutAnsw
er() in c:\LIGHTSTREAMER\LS_SDK_client_dotnet\tmp_src\Source\ExtConnectionListen
er.cs:line 49
at Lightstreamer.DotNet.Client.LSClient.OpenConnection(ConnectionInfo info, I
ConnectionListener listener) in c:\LIGHTSTREAMER\LS_SDK_client_dotnet\tmp_src\So
urce\LSClient.cs:line 198
at Threading.Program.loginStream(Object data) in c:\users\alex\documents\visu
al studio 2015\Projects\Threading\Threading\Program.cs:line 40'

Please let me know what am I doing wrong? Thanks

How to login to the streaming api c#


Are you sure you are using the correct value for PushServerURL? You should retrieve it from the \Session endpoint as it could change.

It is currently returning (for the demo system) not

If you need any further help please email me at as I have built various applications using both the streaming and REST API.

Hope this helps,


Log in or register to post comments