Fórum

Liferay 7 + Liferay Faces Alloy + Websockets

Marcus Hiebenga, modificado 7 Anos atrás.

Liferay 7 + Liferay Faces Alloy + Websockets

New Member Postagens: 20 Data de Entrada: 11/01/17 Postagens Recentes
Hello,

I am trying to get websockets to work in a Liferay Faces Alloy portlet. Until now without success.
I am using Liferay 7.0-ga3. My gradle.build looks like this:


apply plugin: 'war'
apply plugin: 'java'

repositories {
     maven { url "https://repository.liferay.com/nexus/content/groups/public" }
     maven { url "http://repo.maven.apache.org/maven2" }
}

dependencies {
    compile group: 'com.liferay.faces', name: 'com.liferay.faces.alloy', version:'3.0.0'
    compile group: 'com.liferay.faces', name: 'com.liferay.faces.bridge.ext', version:'5.0.0'
    compile group: 'com.liferay.faces', name: 'com.liferay.faces.bridge.impl', version:'4.0.0'
    compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.22'
    compile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.22'
    
    compile group: "javax.websocket", name: "javax.websocket-api", version: "1.1"
	compileOnly group: "javax.servlet", name: "servlet-api", version: "2.5"
	compileOnly group: "org.osgi", name: "org.osgi.compendium", version: "5.0.0"
	compileOnly group: "org.osgi", name: "org.osgi.core", version: "5.0.0"
	
    testCompile 'junit:junit:4.12'
        
    runtime group: 'org.glassfish', name: 'javax.faces', version:'2.2.13'
    providedCompile group: 'javax.faces', name: 'javax.faces-api', version:'2.2'
}


I tried to adapt the tutorial from Cristina Gonzalez:
https://web.liferay.com/de/web/cristina.gonzalez/blog/-/blogs/define-websocket-server-endpoints-using-liferay-websocket-whiteboard
But it doesn´t work with liferay faces. It looks like that the websocket server never starts.
I haven't found a hint in the world wide web, how to acomplish websockets with liferay faces.

Please help me.

I have added my complete working gradle portlet.

Best regards
Marcus
thumbnail
Juan Gonzalez, modificado 7 Anos atrás.

RE: Liferay 7 + Liferay Faces Alloy + Websockets

Liferay Legend Postagens: 3089 Data de Entrada: 28/10/08 Postagens Recentes
Hi Marcus.

In order to separate both problems and discard possible errors, did you try a simple portlet (non JSF) just to check if websocket is working in your 7 GA3 instance?

Seems more changes are need in order to make this working in 7 GA3, check Cristina comment in his blog post: https://web.liferay.com/web/cristina.gonzalez/blog/-/blogs/define-websocket-server-endpoints-using-liferay-websocket-whiteboard.

Additionally, read the needed change in portal-ext.properties here: https://github.com/cgoncas/liferay-websocket-echo

And finally, check with that sample web socket echo example to see if that works. After that, we could check what is failing when using JSF.

Thanks!
Marcus Hiebenga, modificado 7 Anos atrás.

RE: Liferay 7 + Liferay Faces Alloy + Websockets

New Member Postagens: 20 Data de Entrada: 11/01/17 Postagens Recentes
Hi Juan,

thank you for your tips. I got it working.

What had to be done:
1. Copy the file portal-ext.properties into the Liferay server root folder
2. Copy the file com.liferay.websocket.whiteboard-1.0.1.jar into the folder !!Liferay server root folder!!\osgi\modules
3. Deploy the working portlet

Big thanks to Cristina as well.

Regards
Marcus
thumbnail
Juan Gonzalez, modificado 7 Anos atrás.

RE: Liferay 7 + Liferay Faces Alloy + Websockets

Liferay Legend Postagens: 3089 Data de Entrada: 28/10/08 Postagens Recentes
Good to hear that Marcus.

If you have any problem you know where to find us ;-).
thumbnail
Kyle Joseph Stiemann, modificado 6 Anos atrás.

Thread Split

Liferay Master Postagens: 760 Data de Entrada: 14/01/13 Postagens Recentes
Please do not reply to dead threads.

The new thread can be found at https://web.liferay.com/community/forums/-/message_boards/view_message/99417094.