Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
ChrisTutt #1
Member since Mar 2015 · 12 posts
Group memberships: Members
Show profile · Link to this post
Subject: Threading?
I use the main UI thread to create the XmppClient object and add all the event handlers, then connect and it works fine, but if I try to do the same using a background thread then it fails, in that I never receive any events.  Do I have to use the main UI thread?  The problem is that it can take a while to for the client to connect to the XMPP server, so then the UI locks up while it waits.

What am I doing wrong?

Thanks,
Chris
Avatar
Alex #2
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
by default MatriX is invoking the events for you because the Ui normally is not thread safe. For this MatriX is trying to find your dispatcher automatically which cannot work under all conditions.

Did you try the following
  • set AutoInvoke to false on XmppClient
  • set the Dispatcher manual

Alex
Avatar
ChrisTutt #3
Member since Mar 2015 · 12 posts
Group memberships: Members
Show profile · Link to this post
Setting AutoInvoke to false solved it, thanks very much!
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