Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
Govardhan N #1
Member since Mar 2018 · 10 posts
Group memberships: Members
Show profile · Link to this post
Subject: Handler for XMPP Ping request
Hi Alex,

I'm trying to implement ping request handler specified in this link : https://matrix-xmpp.io/docs/handlers

When i create pipeline initializer as it is in the above link, I'm getting error for the below line of code:

  1. pipeline.AddBefore<XmppStanzaHandler>(new XmppPingHandler<Iq>());

The error is,
Severity    Code    Description    Project    File    Line    Suppression State
Error    CS0308    The non-generic method 'IChannelPipeline.AddBefore(string, string, IChannelHandler)' cannot be used with type arguments


Can you help me resolving this error..? Also can you provide me sample code that works in ,Net standard project.. ;-)
Avatar
Alex #2
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
MatriX vNext has already a Ping handler build in.
See:
https://github.com/matrix-xmpp/matrix-vnext/blob/master/sr…

This handler is active by default. Matrix should reply autopmatcially to all ping requests.
Avatar
Govardhan N #3
Member since Mar 2018 · 10 posts
Group memberships: Members
Show profile · Link to this post
Thanks for your reply Alex.

If the handler is active, do we need to define following snippet in our code..?

  1. var pipelineInitializerAction = new Action<IChannelPipeline>(pipeline =>
  2. {
  3.     pipeline.AddBefore<XmppStanzaHandler>(new XmppPingHandler());
  4. });
  5.  
  6. var xmppClient = new XmppClient(pipelineInitializerAction);
Avatar
Alex #4
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
No, MatriX is doing this all already for you.

We will add a note to the tutorial that the sample code is a handler which already exists. Or we will write up another sample handler which does not exist already in MatriX.
Avatar
Govardhan N #5
Member since Mar 2018 · 10 posts
Group memberships: Members
Show profile · Link to this post
Ok thanks Alex.

We changed mod_ping option, timeout_action,kill to timeout_action,none. Now user will stay online until the app is killed forcefully.

Is it the correct way of changing the mod_ping option or will it cause any issue in the future..?
Avatar
Alex #6
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
This change in ejabberd seems to be only a workaround to me, not a real solution.
When the server kills your connections then something is wrong with your replies to the pings.

Check your logs for ping requests and replies to them.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: MatriX RSS