Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Marcus Hiebenga
Liferay 7 + Liferay Faces Alloy + Websockets
January 11, 2017 3:01 AM
Answer

Marcus Hiebenga

Rank: New Member

Posts: 3

Join Date: January 11, 2017

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:

 1
 2apply plugin: 'war'
 3apply plugin: 'java'
 4
 5repositories {
 6     maven { url "https://repository.liferay.com/nexus/content/groups/public" }
 7     maven { url "http://repo.maven.apache.org/maven2" }
 8}
 9
10dependencies {
11    compile group: 'com.liferay.faces', name: 'com.liferay.faces.alloy', version:'3.0.0'
12    compile group: 'com.liferay.faces', name: 'com.liferay.faces.bridge.ext', version:'5.0.0'
13    compile group: 'com.liferay.faces', name: 'com.liferay.faces.bridge.impl', version:'4.0.0'
14    compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.22'
15    compile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.22'
16   
17    compile group: "javax.websocket", name: "javax.websocket-api", version: "1.1"
18    compileOnly group: "javax.servlet", name: "servlet-api", version: "2.5"
19    compileOnly group: "org.osgi", name: "org.osgi.compendium", version: "5.0.0"
20    compileOnly group: "org.osgi", name: "org.osgi.core", version: "5.0.0"
21   
22    testCompile 'junit:junit:4.12'
23       
24    runtime group: 'org.glassfish', name: 'javax.faces', version:'2.2.13'
25    providedCompile group: 'javax.faces', name: 'javax.faces-api', version:'2.2'
26}


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
Attachments: liferay_faces_websocket_portlet.zip (17.7k)
Juan Gonzalez
RE: Liferay 7 + Liferay Faces Alloy + Websockets
January 11, 2017 3:12 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2985

Join Date: October 28, 2008

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!
Marcus Hiebenga
RE: Liferay 7 + Liferay Faces Alloy + Websockets
January 16, 2017 8:01 AM
Answer

Marcus Hiebenga

Rank: New Member

Posts: 3

Join Date: January 11, 2017

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
Attachments: com.liferay.websocket.whiteboard-1.0.1.jar (12.9k), portal-ext.properties (0.6k), working_liferay_faces_websocket_portlet.zip (17.2k)
Juan Gonzalez
RE: Liferay 7 + Liferay Faces Alloy + Websockets
January 17, 2017 12:42 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2985

Join Date: October 28, 2008

Recent Posts

Good to hear that Marcus.

If you have any problem you know where to find us ;-).