GWT. Can be used Channel API without GAE? - java

Channel API it is feature of GAE or feature of GWT? Can I use Channel API with simple GWT RemoteServiceServlet? (my app dont use GAE)

Channel API is a GAE API, so yes you can use it only within the GAE environment. If you are planing to deploy your servlets in GAE, you can still use channel API.
If you are not planning to use GAE as your server, and only use GWT on client/UI side, then you can use other options like Comet (Check link at http://caucho.com/resin-3.1/examples/servlet-comet/ for an example). I am not much aware of other "push" APIs, but some search would give you answers.
Also check http://tomcat.apache.org/tomcat-6.0-doc/aio.html

Related

Connect with iOS and Android clients to SockJS Backend

I'm developing WebSocket messaging backend using Spring WebSockets, which uses SockJS + STOMP protocol. The reason why not to use plain WebSockets is because I will need to leverage security integration that SockJS provides in Spring WebSockets and also other neat features from SockJS, such as rooms, subscriptions, etc. I was wondering if this is a good option to use so that mobile (iOS and Android) and Web client apps can easily connect to the backend server and perform messaging. If yes, then what libraries I can use for iOS and Android.
On SockJS GitHub page they are also listing available client libraries, but no iOS nor Android. So, I'm wondering if SockJS is even worth to use just because of that.
I found that for iOS client Primus-Objc (GitHub page) library claiming that they can connect to native WebSockets, Socket.IO, SockJS or perhaps engine.io. is that a true statement? And event if that's true, what about the quality of that library?
And event if it is ok to use SockJS on the back, then would it be also possible to show an example code for iOS and Android so that I can perform a proof of concept on mobile devices?
If SockJS is not a good option for me, then would it be better than to build my messaging app with Socket.io + Node.js (using JavaScript). Socket.io seems to me have all needed client libraries for iOS (official library by Socket.IO guys) and Android (official library by Socket.IO guys).
Another option can be to use Netty-Socket.io library and build each endpoint manually without any help from Spring Framework (which I'm considering to use) but there is small challenge that I'll have to tackle, that is security. Somebody actually already tried to do it (the same author asking question on the official Netty-Socket.IO Github page) but looks like he didn't have a luck in solving it yet.
Maybe it's more than a year since the question was asked. But, because it's getting in the first results when Googling for SockJS+Android. So, I am posting my answer.
From my experience with a recent project I worked on, we were able to use a STOMP client - like the one here- to connect to Spring Websocket backend from native Android app.
And from the browser, you can still use SockJS client to gain across browsers compatibility to websockets with fallback.
A note to mention that when using only STOMP client to connect to native websocket the URL will be something like ws://mydomain/SockJSEndpoint/websocket,
and when using SockJS client from the browser the URL will be like http://mydomain/SockJSEndpoint.
Please find below useful references related to your requirement for both iOS and Android
http://www.elabs.se/blog/66-using-websockets-in-native-ios-and-android-apps
https://www.cometchat.com/blog/ios-android-chat-mobile-sdk/
https://github.com/elabs/mobile-websocket-example
We have tested them, both Android-client (link) was given by #Amr K. Ismail and
this iOS-client (link) are suitable with Spring-SockJS-Server which has STOMP.
SockJS may be interesting because it provides non-ws transports. Just using WebSockets may not be possible in all situations.
There is one cross-platform SockJs client of the OpenFL project:
https://github.com/jeremyfa/openfl-sockjs
Not tested how well it works, but at least for Android it's using JavaScript from inside WebView, so should be no different than JavaScript one. Again, it is not clear how tightly it is coupled with OpenFL, but the approach of using WebView and stock SockJS client could probably be re-used.

Using WebSockets with Codename One

I am new at using Codename One. I am trying to deploy a server that will interact with my app on Amazon Web Services using OpsWorks. The server is going to run on Apache Tomcat and be a dynamic web project written in Java, and I am wondering the best way to communicate with the Codename One client. I am planning to use the Socket classes provided by Codename One, but and not sure what to use for the server-side code. Will it work to use WebSockets from Apache? I am having difficulty debugging the server code and have hit a wall here. Thanks in advance!
WebSockets aren't compatible with sockets so you will need to code a websocket implementation which is a bit of work. I suggest you use HTTP communication which is more portable and very performant on the devices.
You can also use solutions such as PubNub which allow for fast message based communications.

how can I talk to a blazeds endpoint without flash

i would like to reuse my existing blazeds/java/spring apps to write some html 5 clients. Is anyone aware of a pure js (no swf bridge allowed) client that has pub/sub capability
so far my googling has found 2 projects - jsasmf (which uses a tiny swf) and amf.js which is missing pub/sub, but no other projects besides these 2
any ideas (crazy is fine) on how to do this appreciated
cheers
Why not annotate your blazeds service object implementation with jersey annotations to expose it as a rest service. It should be possible to expose the same service through blazeds and rest at the same time. You could use Atmosphere to implement pub/sub
This may be possible with another server. You would consume the service with flash on that server and expose its api with web sockets (for example) to other clients. Your clients would not need flash installed.
Extending on Erik Martino's answer... you could try compiling a Java AMF client to JavaScript yourself using GWT.
Late to the party but is seems Adobe has a JS Client too. I you download the trail of Dataservices ES 4.6 its in the resource folder. A tutorial can be found here

Best way to manage asynchronous / push communication with web clients on a Spring based Java server

I need to push events to web clients in a cross-browser manner (iPhone, iPad, Android, IE/FF/Chrome/etc.) from a Spring based Java server. I am using backbone.js on the client side.
To my best knowledge, I can either go with a Web socket only approach, or I can use something like socket.io.
What is the best practice for this issue, and which platform/frameworks should I use?
Thanks
Looks like you're interested in an AJAX Push engine. ICEPush (same group that makes ICEFaces) provides these capabilities, and works with a variety of server- and client-side frameworks. There is also APE.
You can have a look at Lightstreamer.
My company is currently using it to push real time financial data from a web server.
I suppose Grizzly or Netty may fit your needs. Don't have a real experience in that scope, unfortunately.
I'd recommend socket.io as you mentioned in your question, if you're doing browser based eventing from a remote host. Socket.io handles all the connection keep-alives and reconnections directly from javascript and has facilities for channeling messages to specific sessions (users). The real advantage comes from the two-way communication of WebSockets without all the boilerplate code of maintaining the connection.
You will need to do some digging for a java implementation thoughConsider running the server directly from V8.

Options other than Applet

I am using the XMPP to build the Chat Application.
For building chat client I am using the Applet to communicate with the XMPP Server using their APIs in Applet.
So my question is: Is there anything other than Applet that I can use to communicate with Server and also with use of the XMPP Client API (i.e. options other than applet)?
I looking into GWT and JavaFX, will those two be helpful in this context?
You can use Java-WebStart or Flex or just write a small webpage using servlets.
Definitely check out Java Web Start. It can launch a JFrame from a link, and offers many deployment advantages.
If you want a browser-based client then use Flash. There are several XMPP browser clients and libraries available.
There are a couple of JavaScript libraries listed on the XMPP website. So no need to rely on browser plug-ins, just do a native web application.
You can easily use GWT for your web application. A quick search on Google revealed some GWT specific third party libraries or XMPP (Emite, gwt-strophe) and even a samples app (Emite Chat).

Categories

Resources