Can''t connect with flash client library

Hi,

befor swiching to jive we used jabberd and openim as servers, both are also accessible by the xiff flash library http://jabberstudio.org/projects/xiff/project/view.php but I cant connect with the flash client any more. It looks like that flash uses a special xml stream method, as the openim server has implemented some special flash stream classes. Will jive support flash xml streams in 2.0, or do we have to move code from opemim to jive ourself. Moving code from BSD license to GPL should not be a problem?

thanks

Guido

Hi Guido,

Because of the way Flash handles XML streams, Jive Messenger cannot communicate with Flash clients yet. I’'ve opened an issue in JIRA at http://www.jivesoftware.org/issues/ to add this improvement to Jive Messenger.

Cheers,

Greg

Sounds good!

As I’'m really interested in this feature because we plan to integrate jive messenger together with a flash client in our open source eLearning product www.olat.org. Feel free to ask if I can help you with this. By the way, if we like to bundle the messenger that is GPL together with our product that is BSD license, do we need a special agreement from jive software?

guido

By the way, if we like to bundle the messenger

that is GPL together with our product that is BSD

license, do we need a special agreement from jive

software?

I would suggest that you instruct users to download Messenger separately rather than bundling it. If your project was commercial, it might be possible to dual license under a commercial license agreement. However, it won’‘t be possible to dual-license under BSD. It shouldn’'t be too hard to come up with sort of solution that works, though – they are both open source projects after all.

Regards,

Matt

Hi Guido,

I have not been able to find a stand-alone flash client that works. Do you know of one that can be downloaded, or do you have a swf that you could share so that we can test Flash support?

Thanks,

Greg

you can download a flash client under http://www.velonummer.ch/pics/ and edit the html file according to your user and server settings. The swf file should be placed on the same machine as the xmpp server lies otherwise the client can’'t connect. this client is now configured with the connection method “terminatedflash” this works for jabberd and openim, but there are other connection methods like: cite xiff library

"XMPPConnection.connect(streamType)

Parameters

streamType (Optional) The type of initial stream negotiation, either flash:stream or stream:stream. Some servers, like Jabber, Inc.’'s XCP and Jabberd 1.4 expect flash:stream from a Flash client instead of the standard stream:stream. The options for this parameter are: “flash”, “terminatedFlash”, “standard” and “terminatedStandard”. The default is “terminatedStandard”."

this client is a alpha version and will soon be released under www.olat.org with full sourcecode.

guido

The flash stuff is rather high priority for me, and I would like to try to implement it myself. Can you give me any suggestions on where and how to add it.

It will be part of my master theis that I write for the www.olat.org learning management system.

thanks!

guido

Hi Guido,

I’‘m pretty new to the Messenger code base myself, so I cannot point anything out specifically, but I’'ll explain how I planned on implementing the fix when I found the time.

The problem is that flash expects the \0 character as part of its XML streams to signal that it (flash) should parse the newest XML in the buffer. Flash also inserts the \0 character at certain points in the XML stream when sending to the server.

The solution would involve watching the socket connection with the client. If \0 is found on the incoming stream it is stripped and a flag is set for that client connection indicating the fact that \0 has been detected. Then, on the outgoing stream, if the \0 flag has been set for that client connection, insert \0 at strategic points in the XMPP stream, such as at the end of an XMPP stanza (packet).

I hope that helps. Let me know how it goes if you try implementing the functionality.

Cheers,

Greg

I tried implementing the flash connection into jive but up to now I wasn’'t very sucessful. I write down everyting I know now and maybe somone can help me further:

The startpoint in jive is +SocketReadThread +, I can create a session by adding the following code: see private void createSession().

The next step is that the flash client sends his authorisation request. Startpoint is as well SocketReadThread, this time method readStream(). ReadStream gets the packet but throws an exception on if (eventType == XMLStreamConstants.END_DOCUMENT) and the connection gets dropped

It looks like that the xml-parser that is used doesnt like the flash termination that looks like that “\000”. As the parser is out of the sun webservice project I think is is not a good idea to change someting over there.

My idea, is to capture the stream bevore he is passed to the xml-parser to get rid of the flash termination. The place to do this is in the run method of the same class: xpp = xppFactory.createXMLStreamReader(new InputStreamReader(sock.getInputStream()));

Any idea how I can filter out those “\000” bevor passing to the parser?

Many thanks!

guido


private void createSession() throws UnauthorizedException, XMLStreamException {

for (int eventType = xpp.getEventType();

eventType != XMLStreamConstants.START_ELEMENT;

eventType = xpp.next()) {

}

// Conduct error checking, the opening tag should be ‘‘stream’’

// in the ‘‘etherx’’ namespace

if (!xpp.getLocalName().equals(“stream”) && !xpp.getLocalName().equals(“flash”)) {

throw new XMLStreamException(LocaleUtils.getLocalizedString(“admin.error.bad-stream”));

}

/*if (!xpp.getNamespaceURI(xpp.getPrefix()).equals(ETHERX_NAMESPACE)) {

throw new XMLStreamException(LocaleUtils.getLocalizedString(“admin.error.bad-namespace”)) ;

}*/

XMLStreamWriter xser = connection.getSerializer();

xser.writeStartDocument();

if(xpp.getPrefix().equals(“flash”)){

         xser.writeStartElement("flash", "stream", "http://www.jabber.com/streams/flash");        

         xser.writeNamespace("flash", "http://www.jabber.com/streams/flash");

         xser.writeNamespace("stream", "http://etherx.jabber.org/streams");

}else{

xser.writeStartElement(“stream”, “stream”, “http://etherx.jabber.org/streams”);

         xser.writeNamespace("stream", "http://etherx.jabber.org/streams");                       

}

    //xser.writeStartElement("stream", "stream", "http://etherx.jabber.org/streams");

    //xser.writeNamespace("stream", "http://etherx.jabber.org/streams");

xser.writeDefaultNamespace(“jabber:client”);

xser.writeAttribute(“from”, serverName);

xser.writeAttribute(“id”, session.getStreamID().toString());

if(xpp.getPrefix().equals(“flash”)){

xser.writeCharacters("\0");

}else{

xser.writeCharacters(" ");

}

//xser.writeCharacters(" ");

xser.flush();

// TODO: check for SASL support in opening stream tag

}


Hey guys,

Today I checked in a fix that adds support for flash clients. Using the XIFF library you will need to use the “flash” method.

I’'ll try to add support for the “terminatedFlash” method before we release our next version 2.1.

Regards,

– Gato

Thanks Gato!

I just tested it with our flash client. The authentication process works and the roster gets delivered but the session does not occur in the list of sessions in the server, so I am not able to send/receive any messages. I’'ll go deeper in to it. May be I find an answer. Thanks again for the fix!

Hey Guido,

I was not able to reproduce your problem. Lets use the same flash code to eliminate variables. I’'m using the example chat code found at http://voisen.org/archives/2004/06/simple_chat_example_with_xiff.php. I only modified the user/password, server address and the method to use for connecting.

Let me know if you are still not seeing your session using this code. If you do see it you can then try to find the difference between this example code and your flash code.

Regards,

– Gato

Thanks for your reply. With the example provided from voisen it works fine. But with our flash client the library sends somewhere a packte that does not get accepted by the server. The packet looks like;

normal

Online

5

and generates a java exception like:

Could not route packet

java.lang.IllegalArgumentException: available

at org.xmpp.packet.Presence$Type.valueOf(Presence.java:298)

at org.xmpp.packet.Presence.getType(Presence.java:81)

at org.jivesoftware.messenger.spi.PresenceRouterImpl.handle(PresenceRout

erImpl.java:68)

at org.jivesoftware.messenger.spi.PresenceRouterImpl.route(PresenceRoute

rImpl.java:50)

at org.jivesoftware.messenger.spi.PacketRouterImpl.route(PacketRouterImp

l.java:88)

at org.jivesoftware.messenger.net.SocketReadThread.readStream(SocketRead

Thread.java:198)

at org.jivesoftware.messenger.net.SocketReadThread.run(SocketReadThread.

java:109)

I’'m not shure but it looks like that this is not standard conform although the jabberd does not complain about a packet of type=“available”. It looks like that this is wrong implemented in the xiff library. What do you think?

thanks guido

That presence packet is definitely incorrect. The xmpp spec clearly says that the initial presence must not include a TYPE attribute nor a TO attribute. Even more, in the XML schemas I don’'t see the “available” type as a valid type value.

I didn’‘t debug the xiff library but I think that in the chat example the library is sending a correct initial presence packet. So you may want to debug what’'s the difference between the chat example and the way your code is using the XIFF library.

Regards,

– Gato

The wrong packet comes from the Roster class, it listens to the login event and sends a packet that is wrong. See Roster.as setPresence() function in the xiff library. I will make a bug report to the library maintainer.

Thanks for your help!

guido

the xiff library maintainer is not active at the moment, so I made the changes myself. By changing to class Roster.as to the following lines the xiff library works well together with jivemessenger:

385: var tempPresence:Presence = new Presence( null, null, null, show, status, priority );

486: setPresence( null, “Online”, 5 );

A patched version of the library (help is not included) is downloadable under:

http://www.olat.org/demo/XIFFLib200B1.mxp

The use the library you have to take the connection methode “flash” and not “terminatedFlash”

guido

guido

Here is my version of XIFF and it works!

http://www.cfide.org/dan_plesse_XIFF_version.rar

Sean and I fixed a few other errors too. Give it a try

and post any fixes.

Thanks Dan

I found a new bug in the xiff lib and fixed it. It convers the Roster class that didnt work if a user was in more than one group present. The jabbrestudio site is still down so I post it here as a place to remember.

guido

you can download a fixed lib here: http://www.olat.org/demo/XIFFLib200B1.mxp

fixed function in Roster.as


private function fetchRoster_result( resultIQ:IQ ):Void

{

// Clear out the old roster

rosterItems.removeAll();

// Go through the result IQ and add each item

var ext:RosterExtension = resultIQ.getAllExtensionsByNS( RosterExtension.NS )[0];

var newItems = ext.getAllItems();

for( var i=0; i < newItems.length; i++ ) {

var item = newItems+;

//if a user is in several groups, add it as item for each group. fix from guido 10.2.2005

for( var j=0; j < item.getGroups().length; j++){

addRosterItem( item.jid, item.name, RosterExtension.SHOW_UNAVAILABLE, “Offline”, item.getGroups()[j], item.subscription.toLowerCase() );

}

}

}

Hey good people

Newguy here, hope no one minds me joining this thread rather than posting a new one. I have recently installed the latest version of Jive and it works great, and I would really like to incorporate the flash client into my web site. I attempted the sample code provided at Voisen, with no luck, I updated the XIFF library, modified the script and included the components, placed the swf on the server, and esthetically, everything looked fine, but there was no communication with the jive server. After reading this thread about a 100 times…lol, i know this script works, but due to my lack of knowledge and experience with flash, well I failed.(truth is, i’‘m a network guy and have just recently delved into the web dev and find myself swirling in a pool of html, php, javascript and flash, but having fun…lol) . So i attempted the client provided at Velonummer, and it connected immediately. which is great, but other than cleaning up the html, I’'m stuck with the asis (no source).

Does anyone have a working script(client) that simply opens a session, enumerates existing users or active users and provides group chat, AND willing to share…please…Ultimately, every member of my site will be provided a chatclient, generated dynamically at registration.

Hope someone can help!

Cheers!

B

Wolverine,

I am attaching the flash program that we were working with internally here at Jive Software. You will need to edit the Flash file (.fla) and change the username/password and server settings. After that, just compile, export, and publish the project and it should work. I am using Jive Messenger 2.1.1 and the XIFF Library 2.0.0 Beta 1 located in this thread (use the recent one)

Also, when you test the flash client in the web, make sure you are using the same server name as your Jive Messenger server. For example, instead of using http://localhost/xmpp/flash.html, I used http://poseidon/xmpp/flash.html.

Good luck, and let us know how it goes!

  • Barry