vaadin 7 websockets - websocket

I am newbie to vaadin. I have few questions:
Does Vaadin 7 or later version supports websockets?
Does Vaadin has any other features like pushing data from server to client (e.g. websockets)?

Vaadin support Atmosphere, so google to get the plugin that will enable websockets.

Server push is the main feature coming with Vaadin 7.1 in a few weeks time. See the Roadmap for current status and the related blog post.
The most downloaded add-on for server push before Vaadin 7.1 is ICEPush but you can find other alternatives in the add-on directory as well.

Update - Push Is Built-In
Both of the other answers by jfarcand (creator of Atmosphere) and Ludd were correct, but are now outdated.
Vaadin 7.3.7 (as of 2015-01) now incorporates the Atmosphere library. Atmosphere provides for built-in support of Push. No need to add any jar, library, plugin, nor add-on. Vaadin Push first tries to use WebSocket technology. If not available, Vaadin Push falls back to other approaches.
Three simple steps:
Add the #Push annotation to your UI subclass
Use a ScheduledExecutorService to update data for your app in the background. Probably best to start and stop the executor service in a ServletContextListener, called as your Vaadin web app launches and shuts down.
When fresh data is ready, the background thread calls the UI::access method to schedule access to, and make changes to, the user interface components (widgets) on the UI thread (the Request-handling thread).
Instead of Step # 2, you might want one user’s main user-interface thread to update another user’s display. Basically the same idea, and covered in the Book Of Vaadin.
Book Of Vaadin
See section 11.16 in The Book Of Vaadin for more info about Server Push.
Minimal Example
In 2015-01, I posted this answer for a minimal example of Push in Vaadin 7. You can copy the content of a single file, to replace your the content of the MyUI class in a new default Vaadin project.

Related

What exactly is a Full-stack development in Spring Boot with Java?

I was under the impression that Angular is integrated as a front-end in the same project as Spring to avail beautiful looking websites as I did once in a previous project in a company.
But as I started looking some videos on youtube and udemy, they are creating a separate project for both angular and spring running on different ports 4200 and 8080.
Is this what a full-stack development is and is this what the companies are asking for in the interviews nowadays? Sorry if the question seems from 2015.
You are correct, each of them is an ecosystem that communicates with each other via nowadays mostly rest.
Each of the code is compiled separately also, typescript and java.
As for full-stack requirements for job its most of the time on one side you have for an example spring boot microservice that does some logic and exposes those results on specific URLs, and you consume those results with your frontend and display them accordingly.
Now, when it comes to frontend you can simply mock values and do your development instead of waiting for someone to finish their backend and after they are done you just write it to the specification that they provide. Most of the time its used Open API ( ex Swagger ).
But basically if you call yourself fullstack developer you need to be able to write backend that emits responses with some results, and write frontend that consumes those responses and displays them. Front side of an application as well as back side.
There are approaches where you use only JS ( nodejs for backend, react or angular for frontend and mongodb for database ), but if you end up in some company where are old-school people, it will be Java on backend and they are looking for youngsters that are Jedi Knights in JS, at least that is what my company did a month ago.

Web Api Versioning for multi tenant saas application

I currently developing a multi tenant saas application using asp web api. The api will be published and consumed by 3rd party application. My question is regarding versioning. I'm struggling to find a way to build the api so that when i updated the api, it wont make 3rd party app that uses the api to stop working. I've seen many api append the version no into the url. But that means that i have to keep old version api until all 3rd party app has been upgraded and use the latest api. I also have to update the old api to adapt to database change. That seems like a lot of work. How do big companies solve this problem?
There is no easy way around this; you will have to do the work to support old versions as long as your customers are using them.
Adopting a RESTful approach in the first place, and avoiding 'fat controllers' may help reduce the pain but beyond that every old API call will need to call into your new service layer and will need to return the results in the format your clients expect.
I'm struggling to find a way to build the api so that when i updated the api, it wont make 3rd party app that uses the api to stop working. I've seen many api append the version no into the url. But that means that i have to keep old version api until all 3rd party app has been upgraded and use the latest api.
No one, absolutely no one has researched, built, versioned and maintained APIs more than NetFlix - not externally but internally. They used explicit versioning (e.g. URL) in their APIs and maintained multiple versions of the same API and got their clients move along by providing incentives (new features). This is also something that can be built into your SLA, e.g. you guarantee support of particular version only for 12 months.
This is a very controversial topic and you will hear people suggesting implicit versioning (e.g. by media type etc). Feel free to listen to those but pragmatism favours explicit and purism favours implicit.

Chat implementation in windows form using SignalR

I am trying to implement chat application in windows form using SignalR. Actually I had created the web chat application using signalR now i want to synchronize it with windows application.
I am facing following problems
1) How to initialize the hub class as in web application we initialize it in javascript on page load. So how can we innitialize the hub and in web application there is global file to maphub for dynamically generating the signalr javascript so where in windows application can i map the hub to dynamically generate the same.
2) As i want to synchronize the windows application with the web application so do i need to keep both the projects under one solution or can i synchronize the two different solutions??
Please provide the startup code for the first problem as i have searched alot but not getting any way to implement the chat in windows form. the code i found on net just raising errors but helping me in any sense.
This is a full working sample for using SignalR in WinForms and WPF
You can download it and play with it.
There is a WinForms Server and Client which can be your starting point.
It is a good idea to keep the projects under one solution, but its up to you. The WinForms projects will need a server URL where they can communicate with each other (you can see this in the sample code from the above link)

Does Cloud Foundry support web sockets?

I have deployed the play framework 2.0's sample websock-chat app onto cloud foundry, but the part after you join the chatroom doesn't display anything. I wondered if this was a websocket support issue, because the app works fine locally.
Yes, CloudFloundry supports Websockets, thanks to its gorouter component.
Support is also available on the PWS instance, on wss: port 4443, see official documentation.
Answering my own question, it appears according to https://cloudfoundry.atlassian.net/browse/CF-45, that the answer is no.
Now with latest updates in CFv2 it has a support for websockets (see this line in the code of gorouter, which is responsible for redirecting requests to your apps). I've written a proof-of-concept app in Node.js (for complete example see my answer here) and it is working fine for my local CF deployment, so I expect it would work for other frameworks and languages also.
However it is not yet working on https://console.run.pivotal.io/, as I suppose because they are not updating deployment of CF with each commit. Also there are some issues with IE 10 and Firefox (which might be CF issues), but in Chrome it works as expected.
if its websockets , then I'll suggest you must go for Jelastic , its easy and reliable.
http://jelastic.com/docs/websockets

GWT or Liferay or just Tomcat: how to initiate update from server-side?

Is it possible to initiate the update of a portlet or web GUI object from the side of server? For example if a chat board is updated on the server how is it possible to ask all web clients to redraw it's contents?
I know that it is possible to query periodically from the client side, but I am interested in initiation namely from server side.
Interested technologies are GWT (Google Web Toolkit), GAE (Google App Engine) and Liferay (Portal server).
Thanks
Have a look for http://www.icepush.org/product/icepush-GWT.html page for IcePush solution to this problem. If you're enough familiar with GWT you'll find all the required information on their wiki.
Check out the GAE Channel API
http://code.google.com/appengine/docs/java/channel/

Resources