Good XMPP Java Libraries for server side? [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I was hoping to implement a simple XMPP server in Java.
What I need is a library which can parse and understand xmpp requests from a client. I have looked at Smack (mentioned below) and JSO. Smack appears to be client only so while it might help parsing packets it doesn't know how to respond to clients. Is JSO maintained it looks very old. The only promising avenue is to pull apart Openfire which is an entire commercial (OSS) XMPP server.
I was just hoping for a few lines of code on top of Netty or Mina, so I could get started processing some messages off the wire.
Joe -
Well the answer to what I am trying to do is somewhat long - I'll try to keep it short.
There are two things, that are only loosely related:
1) I wanted to write an XMPP server because I imagine writing a custom protocol for two clients to communicate. Basically I am thinking of a networked iPhone app - but I didn't want to rely on low-level binary protocols because using something like XMPP means the app can "grow up" very quickly from a local wifi based app to an internet based one...
The msgs exchanged should be relatively low latency, so strictly speaking a binary protocol would be best, but I felt that it might be worth exploring if XMPP didn't introduce too much overhead such that I could use it and then reap benefits of it's extensability and flexability later.
2) I work for Terracotta - so I have this crazy bent to cluster everything. As soon as I started thinking about writing some custom server code, I figured I wanted to cluster it. Terracotta makes scaling out Java POJOs trivial, so my thought was to build a super simple XMPP server as a demonstration app for Terracotta. Basically each user would connect to the server over a TCP connection, which would register the user into a hashmap. Each user would have a LinkedBlockingQueue with a listener thread taking message from the queue. Then any connected user that wants to send a message to any other user (e.g. any old chat application) simply issues an XMPP message (as usual) to that user over the connection. The server picks it up, looks up the corresponding user object in a map and places the message onto the queue. Since the queue is clustered, regardless of wether the destination user is connected to the same physical server, or a different physical server, the message is delivered and the thread that is listening picks it up and sends it back down the destination user's tcp connection.
So - not too short of a summary I'm afraid. But that's what I want to do. I suppose I could just write a plugin for Openfire to accomplish #1 but I think it takes care of a lot of plumbing so it's harder to do #2 (especially since I was hoping for a very small amount of code that could fit into a simple 10-20kb Maven project).

http://xmpp.org/xmpp-software/libraries/ has a list of software libraries for XMPP. Here is an outdated snapshot of it:
ActionScript
as3xmpp
C
iksemel
libstrophe
Loudmouth
C++
gloox
Iris
oajabber
C# / .NET / Mono
agsXMPP SDK
jabber-net
Erlang
Jabberlang
Flash
XIFF
Haskell
hsxmpp
Java
Echomine Feridian
Jabber Stream Objects (JSO)
Smack
JavaScript
strophe.js
xmpp4js
Lisp
cl-xmpp
Objective-C
xmppframework
Perl
AnyEvent::XMPP
PHP
Lightr
xmpphp
Python
jabber.py
pyxmpp
SleekXMPP
Twisted Words
xmpp-psn
xmpppy
Ruby
XMPP4R
Tcl
JabberLib

I went through the same search. I first tried Smack and then realized it's targeted at c2s (client to server) and didn't have what I need. I looked at Tinder but didn't like the licensing model (also when I looked it was much more raw). I finally looked at Whack and realized it was what I needed - but it's missing a lot (that's why Tinder came about I think).
So..my solution? Forked Whack, added some code to abstract out things, and try to make it easier to use: http://github.com/Communitivity/Adirondack
I wrote a Scala library based on that to help create external component based agents, see
http://github.com/Communitivity/Shellack
and http://github.com/Communitivity/MinimalScalaXMPPComponent
One of my main goals was to make it easy to write a component quickly. An example of such a component is below:
object Main {
/**
* #param args the command line arguments
*/
def main(args: Array[String]) :Unit = {
new XMPPComponent(
new ComponentConfig() {
def secret() : String = { "secret.goes.here" }
def server() : String = { "communitivity.com" }
def subdomain() : String = { "weather" }
def name() : String = { "US Weather" }
def description() : String = { "Weather component that also supported SPARQL/XMPP" }
},
actor {
loop {
react {
case (pkt:Packet, out : Actor) =>
Console.println("Received packet...\n"+pkt.toXML)
pkt match {
case message:Message =>
val reply = new Message()
reply.setTo(message.getFrom())
reply.setFrom(message.getTo())
reply.setType(message.getType())
reply.setThread(message.getThread())
reply.setBody("Received '"+message.getBody()+"', tyvm")
out ! reply
case _ =>
Console.println("Received something other than Message")
}
case _ =>
Console.println("Received something other than (Packet, actor)")
}
}
}
).start
}
}

Ignite Realtime shares its Tinder API which is a basic building block extracted from OpenFire just for the creation of server-side components and possibly other servers. It implements basic XMPP building blocks and you are free to start from there.

Also from Ignite Realtime is the Whack API which is specifically for building XMPP components
Whack is an Open Source XMPP (Jabber)
component library for XMPP components.
A pure Java library, it can be
embedded into your applications to
create anything from a full XMPP
component to simple XMPP integrations
such as sending intercepting and
acting on certain messages.

Your best bet is to use an existing server, and add your functionality to it. Writing an entire server from scratch, even using a library, is going to be a lot harder than you expect.
Can you tell us more about the problem you are trying to solve? We can then point you to an appropriate server, and help you with the right place to plug in.

check this out:
this is a lower level library. it is in incubation status and it seems nobody is pushing it. but it is a great api and i hope it will progress.
http://java.net/project/jso-jabber-stream-objects

I think you already looked at the right solution: Openfire
It's not a commercial solution. It's an XMPP Server on top of Mina and Jetty written in Java released under the Apache License. Comes pretty close to what you asked for.
While I know that you asked for a library, why not use some stable developed open source software that can easily be extended like openfire?

I found a good xmpp server based on Java : http://www.tigase.org/

Have a look at Vorpal. Its a Java EE 6 framework that implements XEP-0114 protocol.

I know that the intent is to build a small hack in the OP.
However, if there is ever an interest in scaling it, end-to-end security,
etc. I would suggest looking at Soapbox from Coversant.
They are our partner. We use SMACK on our hard realtime virtual machine environment, JamaicaVM to communicate with Soapbox.
Also, if the intent is to communicate with a server app, and not to reimplement
an XMPP server (e.g. Soapbox), the SMACK client can be used for that.
It is a client to the XMPP server, but the instance of actual communications can be
from client to client through the XMPP server.

Related

OneM2M: Get Notification once a file loads on FTP server [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I have a device that sends data to a FTP server. In OM2M, I want to implement an IPE to access this data and send it to MN-CSE.
Currently I am fresher on oneM2M standards And as per the below reference I found the 2 alternative for this task.
The ftp server notifies your AE (it is constrained for us to not to make any change on FTP server configuration so we are unable to go with this approach)
Your AE implements the ftp server and would then be able to directly react on new data events.
Here I just want to adopt the second approach so if possible can I get any reference so that I can proceed with that as there is not such documentation available that I found on Internet. Or kindly mention if there is any other approach that best suits to oneM2M standard for this issue.
And I just want to get confirmation that if we are monitoring FTP server periodically for the incoming input file and then process them and send them to MN-CSE then whether this approach suits to oneM2M standards or not ??
OneM2M: IPE that periodically fetches device data from FTP server
This question is indeed about different integration options. In general, it is one or more Application Entities (AE) that operate with the resources / data in a CSE. Every tool, application, protocol gateway, or "adaptor" is, from oneM2M perspective, an AE.
A special form of AE is the IPE, the Interworking Proxy Entity. It is used to connected another system or infrastructure to a CSE and mediate between these two worlds. The CSE part, ie. the protocol and the data formats etc, are covered by the oneM2M specification, and the other part must then implement the other protocol and technical specifications. The actual task is then to convert the data and expected behaviour between both worlds.
I am not sure from your description whether what you are planning is such a protocol "gateways", or just push the data received via an ftp server to a CSE. But technically, this doesn't matter much for the oneM2M part: You need to define how the data is structured on the CSE etc anyway.
For the data retrieval: As you mention in your question there is a third option to the other two:
The AE monitors an external system for new or updated resources, and pushes them to the CSE as soon as when they are ready.
From oneM2M's perspective this is completely fine. Technically you must make sure how to find out when the data is new, completely received, still valid, etc. ... basically all the challenges when you are polling resources. The first two options would be more helpful because you would avoid some of the problems that come with polling, but as you wrote sometimes you just don't have control about the system you want to connect to.

Is it possible to record audio from client to server in PHP- or JAVA-based online web application?

I am building an online web application which offers clients to test their language skills.
The application consists of series of different test the clients can freely do. One of these tests is one where the client sees a sentence on the web-page and then is required to speak the sentence to a microphone. The idea would be to record the audio stream, send it to server and save it there to a file.
Is this possible using PHP, Java, or something similar to them?
Thank you for any help :)
I know you asked for PHP, I'm guessing that's your language of choice, but have you considered using html5 to record your audio? Note: browser support is still lacking but it might be worth looking into depending on your requirements.
Check out this tutorial; it uses the GETUSERMEDIA API to access you camera and microphone hardware.
Update: Here is another good tutorial on the subject.
The only realistic solutions for solving the problem are with flash, as suggested by another answer, or a java applet. In a year or two that will hopefully change and you'll be able to use javascript and HTML5, but this is now.
I would say this is a problem better and more easily solved with flash, but for java, You need to write a java applet to do the recording. Here are some hints to get you started:
http://docs.oracle.com/javase/tutorial/deployment/applet/
http://www.java2s.com/Tutorial/Java/0120__Development/CapturingAudiowithJavaSoundAPI.htm
http://www.jsresources.org/
You do not need java speech API or JMF, just java sound. You might WANT JMF to compress the audio file to make uploading go faster, but you can get this working without. Note that you may need to "sign" your applet in order to record audio in a browser.
If you are averse to flash, you could also use haxe to write your flash code.
Not 100% what you're looking for but I think it'll at least give you some ideas.
How to record streaming audio to the server
It is possible to solve this problem using Flash and Java both. You can use Flash component to record sound and send it in chunks to server side which can be implemented using java.
Pros to create sound recorder in Flash are many.
Flash is widely installed plugin in Browser
Java Applet gives warning before running it which many times turns off users.
Numerically checked, most media applications are created using Flash thereby providing you nice support.
Java Applets are used where thick client has to fit into browser and must also be secure. You will still find many real time treading applications are written in java applets.
Here are couple of tutorials to create Sound Recorder in Flash
http://active.tutsplus.com/tutorials/actionscript/create-a-useful-audio-recorder-app-in-actionscript-3/
Adobe record sound and save
This collected stream of sound can be stored in chunks on client side and can be synced with backend server(any server side language shall be fine.).
Implementing your server in Java has advantage. If tomorrow need arises, you can stream the same sound using Red5 server which is implemented in Java.
See more here: http://www.red5.org/
There is an audio recording SDK for this which is written in PHP, Flash and HTML5. http://recordmp3online.com
I am actually the author of that SDK (full disclosure)

Wondering about capabilities of titanium appcelerator?

We have a web application that uses (java/Java EE, Struts, Hibernate) running on Apache tomcat using MySQL as the DB. It has been up and running for quite a few years, so we have a very large pool of data (millions of row).
We need to convert this web app to a mobile application (cross platform, ios, Android), so we've decided to use the Titanium Appcelerator.
I have quite a few concerns before implementation:
I've heard that titanium gives you very good gui, but what about the functionality? What happens when a user clicks a buttons (sending/retrieving data from db)?
Can I use java to handle this??
I have seen examples of interacting through database, but approx all are using PHP as as a server side language, but nobody knows PHP here.
Though our team has some android exp(all sort of JSON, small client app), I am not sure whether it would be helpful.
Out goal is to convert a huge CRUD web app to a cross platform mobile app (I dont want to lose java on the server). Can Titanium appcelerator handle this?
See the App as something separate. It doesn't matter what is on the other end, as long as you get either JSON or XML (or something else if you prefer).
Titanium Appcelerator is a JavaScript tool that can handle (both build-in) JSON and XML.
To answer your questions:
1: Functionality is really good. It cannot be done by Java, but you'll get events (in JavaScript) which handles click/swipe/press/doubleclick etc. Events are always defined in the Documentation. In your case, the button. You can see what events it can handle there, and what properties you can set.
An example from the docs page adding a button, and having the click event.
var button = Titanium.UI.createButton({
title: 'Hello',
top: 10,
width: 100,
height: 50
});
button.addEventListener('click',function(e)
{
Titanium.API.info("You clicked the button");
});
2: Whatever server side language you use, as long as you export usable content (JSON/XML) it is useable by Titanium. It acts like a client. No need to worry there.
3: as answered above, you can do everything with it you want. On server side you only need to write an API which can handle everything.
I hope this will take away your concerns. If you need more help on other questions, just enter a new question on SO and I'll see them pass by.
As already stated by Topener, Titanium is able to handle your requirements. I'd like to point out something more fundamental:
We need to convert this web app to a mobile application (..), so we've decided to use the Titanium Appcelerator.
I'm somewhat surprised by this reasoning, kinda "We needed a car, so we decided to buy a Nissan." Why not a Ford, a Holden or a Porsche?
There are in fact well over 30 technologies claiming to be able to do cross-platform mobile development. I took a deep look at 16 of them during the course of last year for my master's thesis.
I'd suggest you have a look two other technologies as well. Why? You are converting a web app to a mobile app. Why not consider a framework that allows you to write your app's UI using web technologies? You might be able to port some of the existing UI-code, after all.
PhoneGap (free, now owned by Adobe): You implement the entire app in JavaScript, basically as a WebApp, but you get a native, installable binary that can be distributed using the AppStores. Easy to combine with a SenchaTouch HTML5-UI.
Rhodes (free, now owned by Motorola Systems): You implement the UI in HTML5 and the logic in Ruby. Rhodes provides a really good Object-Mapper and Sync capabilities. As you seem to have quite a bit of data to handle, this could provide a significant advantage over Titanium's SQLite Database. Learning the bits of ruby should not cost you more than a week or so.
If you definitely need a native UI, then the AQUA-Framework might be worth a look... but I havn't tested that one.

Programming a GSM phone/modem to make phone calls

I want to use a program written in a high level language like Java or Python to talk to a GSM Modem.
I want to be able to tell the modem what number to call and when to call it. I also want to be able to read and send text messages.
I do NOT need to handle voice transmission in either direction of the call.
I'd appreciate recommendations of any applicable libraries and specific modems that are good to start with? I like Java but am willing to try something else.
Thanks
There are a set of relatively standard "AT" commands that can be used for these types of operations - including placing phone calls and sending text messages. Some details around this are at http://www.smssolutions.net/tutorials/gsm/sendsmsat/ and http://www.dreamfabric.com/sms/ (simply first results of a little online searching).
A little more online searching yielded a Java-specific example at http://www.java-samples.com/showtutorial.php?tutorialid=22 .
I had done a little bit of this in Java a number of years back, using the Java Communications API - available at http://www.oracle.com/technetwork/java/index-jsp-141752.html . (My purpose was for interfacing with the phone book on my phone, but this also should have worked with interfacing with the SMS system.)
Almost all modems and (phones which support tethering to your PC) can do this. All modems are equally good at it.There are no starter's modems. Just go through the AT commands specific to your applications and thats it.

System requirements for Cometd/Bayeux Usage on Android

I'm trying to implement a Cometd/Bayeux server on Android using iJetty. The Jetty implementation itself works just fine serving static pages along with servlets. I am trying to up the ante a bit and create a Bayeux application on the phone but I'm having some trouble. I can hit the page that has the dojo cometd scripts on it, but I am unable to subscribe to the channel. When I view firebug/chome developer tools, I see a series of posts/gets that last a couple of milliseconds (~14). However, when I run a cometd application on a normal machine, the posts/gets last several seconds (~14 seconds) before timing out and reopening the connection. This second scenario makes sense to me with my understanding of how continuation in HTTP works. So I'm thinking that something is not allowing those connections to hang open and prematurely returning a value and consequently closing the connection. I would post my source but I'm not sure what to post short of posting everything...(it is open source though so if you want to have a look it's at http://webtext-android.googlecode.com).
So my question is, does anybody think that there could be some underlying limitation imposed by the Android system that is preventing these servlets from working? Are there assumptions that are made by the Jetty Bayeux implementation with regards to the underlying system? Or is it more likely that somehow I have a bad implementation of the ContinuationCometdServelt? I should note that all of the posts/gets from the client return 200 OK messages so I'm not inclined to think that the Android system is simply terminating the connection.
I know this is a bit off the wall and I'm definitely trying to do something a bit out of the ordinary but any suggestions or tips would be greatly appreciated.
In case anybody discovers this and has similar problems (this applies to all cometd implementations regardless of host), I discovered that the issue was with using the Google js library. For some reason, the dojo scripts I was loading from Google (1.4) didn't have a valid implementation of cometd. I switched my dojo script to the one that was used by the jetty-1.6.23 example and it works perfectly.

Categories