Question

I would like to intiate with websockets in GWT and before i use the Asynchrone Call Back this is an example for how i work before :

In a Package Client :

@RemoteServiceRelativePath("handler/categorieService")
 public interface CategorieServiceGwt extends RemoteService {

/**
 * Récupèrer la catégorie à travers l'identifiant passé en paramètre.
 * @param un identifiant de la catégorie.
 * @return la catégorie trouvée.
 */
CategorieModel getCategorieById(Long id) throws GwtRunTimeExceptionGwt;
}

the the Asynchrone Interface : public interface CategorieServiceGwtAsync {

/**
 * Récupèrer la catégorie à travers l'identifiant passé en paramètre.
 * @param un identifiant de la catégorie.
 * @return la catégorie trouvée.
 */
void getCategorieById(Long id, AsyncCallback<CategorieModel> callback);

}

In a package server implement the CategorieServiceGwt interface :

public final class CategorieServiceGwtImpl implements CategorieServiceGwt {

private MapperDozerBean mapperDozerBean;

private CategorieService categorieService;

@Override
public CategorieModel getCategorieById(Long id) {
    return mapperDozerBean.map(categorieService.getCategorieById(id), CategorieModel.class);
}

So i see in internet some example for websockets but i dont see how use it for example in this case ?

Was it helpful?

Solution

I'd recommend using a well known js solution through native binding. Websockets and comet have issues that show up only lately in your project: I had a bad exeperience in 2011 with a GWT lib where connections where closed but me not notified, unable to reconnect etc...

I've spent two weeks understanding the lib and finding many things had to be rewritten. So if you know about a good js/jQuery library for that, I'd recommend you use that one

OTHER TIPS

First result on Google for "gwt websockets" are this project:

https://code.google.com/p/gwt-ws/

Have a look, maybe it works for you.

Happy coding!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top