Package org.idempiere.ui.zk.websocket
Class WebSocketServerPush
java.lang.Object
org.idempiere.ui.zk.websocket.WebSocketServerPush
- All Implemented Interfaces:
org.zkoss.zk.ui.sys.ServerPush
Server push implementation using web socket
- Author:
- hengsin
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanactivate(long timeout) booleandeactivate(boolean stop) static ServerPushEndPointgetEndPoint(String dtid) Get web socket end point for desktopprotected static StringgetLocalBaseUrlAttribute(String desktopId) Build the session attribute name for a desktop's node-local connector URL.booleanisActive()static booleanisValidDesktopId(String dtid) voidstatic voidregisterEndPoint(String dtid, ServerPushEndPoint endpoint) Register web socket end point for desktopvoidresume()<T extends org.zkoss.zk.ui.event.Event>
voidschedule(org.zkoss.zk.ui.event.EventListener<T> task, T event, org.zkoss.zk.ui.sys.Scheduler<T> scheduler) voidstart(org.zkoss.zk.ui.Desktop desktop) voidstop()static booleanunregisterEndPoint(String dtid) Remove web socket end point for desktop
-
Field Details
-
WEBSOCKET_EVENT_COOKIE_STORE
- See Also:
-
WS_CLIENT_IP
- See Also:
-
WS_LOCAL_BASE_URL
- See Also:
-
-
Constructor Details
-
WebSocketServerPush
public WebSocketServerPush()
-
-
Method Details
-
activate
public boolean activate(long timeout) throws InterruptedException, org.zkoss.zk.ui.DesktopUnavailableException - Specified by:
activatein interfaceorg.zkoss.zk.ui.sys.ServerPush- Throws:
InterruptedExceptionorg.zkoss.zk.ui.DesktopUnavailableException
-
deactivate
public boolean deactivate(boolean stop) - Specified by:
deactivatein interfaceorg.zkoss.zk.ui.sys.ServerPush
-
isActive
public boolean isActive()- Specified by:
isActivein interfaceorg.zkoss.zk.ui.sys.ServerPush
-
onPiggyback
public void onPiggyback()- Specified by:
onPiggybackin interfaceorg.zkoss.zk.ui.sys.ServerPush
-
schedule
public <T extends org.zkoss.zk.ui.event.Event> void schedule(org.zkoss.zk.ui.event.EventListener<T> task, T event, org.zkoss.zk.ui.sys.Scheduler<T> scheduler) - Specified by:
schedulein interfaceorg.zkoss.zk.ui.sys.ServerPush
-
start
public void start(org.zkoss.zk.ui.Desktop desktop) - Specified by:
startin interfaceorg.zkoss.zk.ui.sys.ServerPush
-
getLocalBaseUrlAttribute
Build the session attribute name for a desktop's node-local connector URL.- Parameters:
desktopId- ZK desktop identifier- Returns:
- session attribute name
-
stop
public void stop()- Specified by:
stopin interfaceorg.zkoss.zk.ui.sys.ServerPush
-
resume
public void resume()- Specified by:
resumein interfaceorg.zkoss.zk.ui.sys.ServerPush
-
registerEndPoint
Register web socket end point for desktop- Parameters:
dtid- Desktop idendpoint- Connected web socket end point
-
unregisterEndPoint
Remove web socket end point for desktop- Parameters:
dtid- Desktop id- Returns:
- true if there's end point register previously for desktop, false otherwise
-
getEndPoint
Get web socket end point for desktop- Parameters:
dtid- Desktop id- Returns:
- Web socket end point
-
isValidDesktopId
- Parameters:
dtid- desktop id- Returns:
- true if serverpush started for dtid, false otherwise
-