It seem this issue based on an bug in Messages.as, which causes in the getter method “state()”. Sending a message a state is by default null and the getter method doesn’t handle it in a right way. It just create an invalid XML mentioned above.
To fix this issue, the constructor of Message has to include a default state, which should not be null. (Note the new value for chatState ):
You are right, a connection class have not a sendMessage method.
Anyway, I did mean room.sendMessage(); And there I have had some issues, which causes of a null value of chatState:String in the constructor of Message.
To avoid this issue, it has to be chatState:String = ChatState.ACTIVE. Please check out again the details and code I posted above.
var msg5:Message = new Message( new EscapedJID("room@conference.server.com/sender"), null, "I am afraid of the dark",
null, Message.TYPE_GROUPCHAT );
trace("room body: " + msg5.body);
trace("room htmlBody: " + msg5.htmlBody);
trace("room state: " + msg5.state);
trace("room subject: " + msg5.subject);
trace("room thread: " + msg5.thread);
trace("room time: " + msg5.time);
trace("room getNode(): " + msg5.getNode().toString());
Results:
room body: I am afraid of children
Error : null trapped. Resuming.
room htmlBody: null
room state: null
room subject: null
room thread: null
room time: null
room getNode(): I am afraid of children