Forums

angle-left Back

Liferay 7 + Liferay Faces Alloy + Websockets

MH
Marcus Hiebenga, modified 1 Year ago.

Liferay 7 + Liferay Faces Alloy + Websockets

New Member Posts: 4 Join Date: 1/11/17 Recent Posts
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
Juan Gonzalez, modified 1 Year ago.

RE: Liferay 7 + Liferay Faces Alloy + Websockets

Liferay Legend Posts: 3073 Join Date: 10/28/08 Recent Posts
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!
MH
Marcus Hiebenga, modified 1 Year ago.

RE: Liferay 7 + Liferay Faces Alloy + Websockets

New Member Posts: 4 Join Date: 1/11/17 Recent Posts
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
Juan Gonzalez, modified 1 Year ago.

RE: Liferay 7 + Liferay Faces Alloy + Websockets

Liferay Legend Posts: 3073 Join Date: 10/28/08 Recent Posts
Good to hear that Marcus.

If you have any problem you know where to find us ;-).
Kyle Joseph Stiemann, modified 7 Months ago.

Thread Split

LIFERAY STAFF Liferay Master Posts: 657 Join Date: 1/14/13 Recent Posts
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.