Subject: Message is not send correctly
Hello guys I'm writing an ChatServer and I'm got very far on this.
I've written several clients which can correctly connect and correctly send messages .
No I've written a small ChatClient class which can connect to the ChatServer and send a message by given arguments.
So, now if I wan't to send the message the server receives each Tag in the XML structure so I've debbuged by subscribing to the "OnSendXml" event. The clients sends the message correctly:
BUT: The Server only received
So why is this happening on other clients I do the equal same. I'm not able to find my issue.
I hope you can help me.
Here is the code from my client class
Additional: I'm using the StreamParser on the server side to parse received socket data, on other clients the "Message" Tag is correctly parsed
Best Regards
Michael
I've written several clients which can correctly connect and correctly send messages .
No I've written a small ChatClient class which can connect to the ChatServer and send a message by given arguments.
So, now if I wan't to send the message the server receives each Tag in the XML structure so I've debbuged by subscribing to the "OnSendXml" event. The clients sends the message correctly:
- <message xmlns="jabber:server" id="5341abc9-f711-4b18-9993-157c3b54c909" type="groupchat" from="{correct user jid}" to="{correct user jid}">
- <body>Test</body>
- <delay xmlns="urn:xmpp:delay" stamp="2017-07-28T07:22:17.507Z"/>
- </message>
BUT: The Server only received
- <body>Test</body>
So why is this happening on other clients I do the equal same. I'm not able to find my issue.
I hope you can help me.
Here is the code from my client class
- public class ChatClient
- {
- public string CurrentUserJid{ get; }
- private XmppClient XmppClient { get; }
- public bool LoggedIn { get; set; }
- public string Email { get; set; }
- public string LoginName { get; set; }
- public event EventHandler OnLoggedIn;
- public event EventHandler OnError;
- //need email & loginName for non identity login
- public ChatClient(string server, int port, string loginName, string email, string passowrd)
- {
- Email = email;
- LoginName = loginName;
- XmppClient.SetUsername(LoginName);
- XmppClient.SetXmppDomain(Environment.UserDomainName);
- XmppClient.Port = port;
- XmppClient.StartTls = true;
- XmppClient.Hostname = server;
- XmppClient.ResolveSrvRecords = false;
- XmppClient.Resource = LoginName;
- XmppClient.AutoRoster = false;
- XmppClient.AutoPresence = true;
- XmppClient.Password = passowrd;
- XmppClient.OnSendBody += (sender, args) =>
- {
- };
- XmppClient.OnSendXml += (sender, args) =>
- {
- };
- XmppClient.OnLogin += (sender, args) =>
- {
- LoggedIn = true;
- OnLoggedIn?.Invoke(this, null);
- };
- XmppClient.OnError += (sender, args) =>
- {
- OnError?.Invoke(this, null);
- };
- }
- public void Login()
- {
- XmppClient.Open();
- }
- public bool SendMessage(string content, string to, MessageType messageType, DateTime sendTime)
- {
- if (!LoggedIn) return false;
- msg.Type = messageType;
- msg.Id = Guid.NewGuid().ToString();
- XmppClient.Send(msg);
- return true;
- }
- }
Additional: I'm using the StreamParser on the server side to parse received socket data, on other clients the "Message" Tag is correctly parsed
Best Regards
Michael
Michael Trinkies
Show profile
Link to this post