Class WebSocketTransportEndpoint
java.lang.Object
com.levigo.jadice.web.transport.server.networking.websocket.WebSocketTransportEndpoint
- All Implemented Interfaces:
com.levigo.jadice.web.transport.server.session.internal.TransportSession
public class WebSocketTransportEndpoint
extends Object
implements com.levigo.jadice.web.transport.server.session.internal.TransportSession
The WebSocketTransportEndpoint dispatches all incoming and/or outgoing messages using the
WebSocket protocol.
Note: The WebSocket container will instantiate a new instance of this class for each client.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close
(jakarta.websocket.Session session) This gets called by the WebSocket implementation of the application server, once a session is closed.boolean
dispatch
(com.levigo.jadice.web.transport.server.session.internal.ServerToClientMessage message) Try to dispatch a message via the transport connection to the connected client.void
This gets called by the WebSocket implementation of the application server, once aThrowable
was thrown.com.levigo.jadice.web.transport.server.session.internal.ClientSessionRegistry
Deprecated.Return the method used to communicate with the client, i.e. the kind of transport that is used.void
init
(com.levigo.jadice.web.transport.server.session.internal.TransportManagerInternal transportManager) Sets the currentTransportManager
.void
message
(jakarta.websocket.Session session, jakarta.websocket.PongMessage pongMsg) This is fired by the WebSocket implementation of the application server, once aPongMessage
was received.void
This is fired by the WebSocket implementation of the application server, once a message was received.void
open
(jakarta.websocket.Session session, String clientId, Long lastEventId, jakarta.websocket.EndpointConfig config) This gets called by the WebSocket implementation of the application server, once a session is opened.void
shutdown()
Perform a server-initiated shutdown of the transport session.
-
Constructor Details
-
WebSocketTransportEndpoint
public WebSocketTransportEndpoint()
-
-
Method Details
-
open
public void open(jakarta.websocket.Session session, String clientId, Long lastEventId, jakarta.websocket.EndpointConfig config) throws IOException This gets called by the WebSocket implementation of the application server, once a session is opened.- Parameters:
session
- the session which was closed by the WebSocket implementationclientId
- the identifier of the client, passed with the client requestlastEventId
- the id of the latest event, passed with the client requestconfig
- the configuration of this endpoint given by the websocket container- Throws:
IOException
- once an error occurred sending initial messages
-
message
This is fired by the WebSocket implementation of the application server, once a message was received.- Parameters:
session
- this is the WebSocket session for the client that gets injected by the application servermessage
- the message that was received from the client
-
message
public void message(jakarta.websocket.Session session, jakarta.websocket.PongMessage pongMsg) This is fired by the WebSocket implementation of the application server, once aPongMessage
was received.A pong is send as an answer of a ping. A Ping frame may serve either as a keepalive or as a means to verify that the remote endpoint is still responsive.
- Parameters:
session
- this is the WebSocket session for the client that gets injected by the application serverpongMsg
- this is the pong message of the WebSocket protocol that was received from the client- See Also:
-
error
This gets called by the WebSocket implementation of the application server, once aThrowable
was thrown.- Parameters:
session
- this is the WebSocket session for the client that gets injected by the application servert
- the error which was thrown by the WebSocket implementation
-
close
public void close(jakarta.websocket.Session session) This gets called by the WebSocket implementation of the application server, once a session is closed.- Parameters:
session
- the session which was closed by the WebSocket implementation
-
getClientSessionRegistry
@Deprecated public com.levigo.jadice.web.transport.server.session.internal.ClientSessionRegistry getClientSessionRegistry()Deprecated.- Returns:
- the
ClientSessionRegistry
-
init
public void init(com.levigo.jadice.web.transport.server.session.internal.TransportManagerInternal transportManager) Sets the currentTransportManager
.- Parameters:
transportManager
- the currentTransportManager
.
-
dispatch
public boolean dispatch(com.levigo.jadice.web.transport.server.session.internal.ServerToClientMessage message) Description copied from interface:com.levigo.jadice.web.transport.server.session.internal.TransportSession
Try to dispatch a message via the transport connection to the connected client. Returntrue
if dispatching was successful,false
otherwise.- Specified by:
dispatch
in interfacecom.levigo.jadice.web.transport.server.session.internal.TransportSession
- Parameters:
message
- that should be sent to the client.- Returns:
true
if message could be forwarded,false
otherwise
-
getMethod
Description copied from interface:com.levigo.jadice.web.transport.server.session.internal.TransportSession
Return the method used to communicate with the client, i.e. the kind of transport that is used.- Specified by:
getMethod
in interfacecom.levigo.jadice.web.transport.server.session.internal.TransportSession
- Returns:
- The current communication method of client.
-
shutdown
public void shutdown()Description copied from interface:com.levigo.jadice.web.transport.server.session.internal.TransportSession
Perform a server-initiated shutdown of the transport session.- Specified by:
shutdown
in interfacecom.levigo.jadice.web.transport.server.session.internal.TransportSession
-