-
Notifications
You must be signed in to change notification settings - Fork 34
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
Reconnection issue #3
Comments
Thanks for the observation Raj. This is the responsibility of the library for sure, and I'm pretty sure we tested this well on our end. |
Well, after the server went down and came back up, the client never received any messages from the server. I had to restart my .net client to connect back again and start getting the messages. I am wondering if I am missing some addition of a listener - like disconnect and then connect again. What do you suggest. Raj |
@srkamineni - Even am facing the same issue - |
@guruprasad83 using Cometd.Bayeux;
using Cometd.Bayeux.Client;
using System;
namespace Foobar.Utilities
{
public class LoggingExtension : IExtension
{
private static NLog.Logger logger = NLog.LogManager.GetLogger("Foobar");
public event EventHandler ConnectionError;
public bool rcv(IClientSession session, IMutableMessage message)
{
return true;
}
public bool rcvMeta(IClientSession session, IMutableMessage message)
{
if (message.Successful)
{
logger.Debug(message.JSON);
}
if (message.ContainsKey("exception"))
{
logger.Fatal(message["exception"]);
}
if (message.ContainsKey("error"))
{
logger.Error(message["error"]);
if (message["error"].ToString().ToLower() == "403::unknown client")
{
this.OnConnectionError();
}
}
return true;
}
public bool send(IClientSession session, IMutableMessage message)
{
return true;
}
public bool sendMeta(IClientSession session, IMutableMessage message)
{
return true;
}
private void OnConnectionError()
{
this.ConnectionError?.Invoke(this, new EventArgs());
}
}
} Afterwards you need to add the extension to your bayeuxClient and subscribe to the event where you can re-establish the connection LoggingExtension loggingExtension = new LoggingExtension();
loggingExtension.ConnectionError += loggingExtension_ConnectionError;
bayeuxClient.addExtension(loggingExtension); |
@ohaucke - Can you please share code for extension. I am facing the same issue |
@swagathchandra I already posted it ( |
Hi @ohaucke , Thanks for the information. It is very helpfull for me, however I'm not sure of understand what is the steps to add into the EventHanlder (loggingExtension_ConnectionError). Should I connect to the instance again into the handler? or into the hanlder only is needed subscribe to the channels again? |
Hi @nahoj28, sorry that is way in the past, so i don't remember it but from the code, i would say you need to completely reconnect because the accesstoken isn't valid anymore. |
After the server goes down, the .net client is not reconnecting at all. My understanding was that it clients will try to reconnect after the server goes down.
Or is there any thing that we can do to reconnect.
Thanks
Raj
The text was updated successfully, but these errors were encountered: