Let’s continue exploring the new DataServices JavaScript Client. This time, we write a simple HTML/JavaScript chat application that talk to other Flex/Flash based chat applications using DataServices.
If you want to run the HTML/JavaScript chat sample, put Chat.html next to Chat.swf along with dataservices-client.js that’s under resources/client-sdk/javascript folder of DataServices installation.
Advertisement


Flex Coder
November 17, 2011 at 2:15 am
Hello Mete,
Nice example but this isn’t working for me.
I have put your code in to my HTML page and also include the Javascript in this page but its not working for me. It just shows the fault alert message.
Can you please help me to solve this issue.
One more thing, In this example you have used dataservices-client.js file but u can’t find in to that location which you have mention but in that folder i have found flex-messaging-client.js file. so i have included that file in to my HTML page.
Thanks,
Mete
November 17, 2011 at 3:16 am
You need to define my-polling-amf as the channel of the destination in messaging-config.xml, did you do that? Also, are you sure you are using the latest preview build of DataServices? In earlier previews, we had flex-messaging-client.js but then we renamed that to dataservices-client.js in the later ones. So please make sure you download the latest one from Adobe Labs.
Flex Coder
November 17, 2011 at 3:24 am
Hello Mete,
Thanks for your reply. Its working now. I haven’t add channels in to the destination. After adding the channels in to the destination, its work for me. I have old version but its also work fine with the old version of ADEP.
Thanks,
Shaival
November 30, 2011 at 12:46 am
Hello mete,
I have made chat application in the Flex and i am using rtmp channel but this application only works on the RTMP channel, it isn’t work on any other channel. Is it possible to use any other channel in this chat application ? If yes, How? I have add all the channels in to the destination.
I also want to know, Can we use MultiTopicConsumer / MultiTopicProducer in to the chat application ?
Thanks,
Mete
November 30, 2011 at 2:28 am
Yes, you can use any channel you want with this application. First, you need to find the destination in messaging-config.xml and add the channel (or a list of channels) to the destination. This way, you can have the destination accept requests from multiple channels. Second, from the client, you need to create a Channel (other than rtmp), add to ChannelSet, and set it to Producer/Consumer. See the sample code I provided.
Yep, MultiTopicConsumer/Producer are supported in all clients, so you can use them for sure.
Shaival
November 30, 2011 at 7:04 am
Hello Mete,
Thanks for your support.
Its work fine now. I can use any channel for the chat application.
Yes, MultiTopicConsumer/Producer is supported in to the application. Actually i haven’t add “true” this attribute in the messaging config ‘s destination. After adding it, its work for me fine.
Thanks,
kaushal shah
November 30, 2011 at 1:26 am
Hi Mete,
This is really nice example, can I do this same for Android/iPhone native apps?
I am really interested to know all of this.
Thanks,
Mete
November 30, 2011 at 2:25 am
Yes, DataServices 4.6 comes with Android and iOS client SDKs, so you can write the same app for Android and iOS as well natively. I’ll try to get an Android sample together and post it here.
kaushal shah
November 30, 2011 at 4:46 am
Mete,
thanks for your quick response, I will upgrade my DataService with 4.6 and will go through it. thanks again.