Package dev.hilla.push
Class PushMessageHandler
- java.lang.Object
-
- dev.hilla.push.PushMessageHandler
-
@Service public class PushMessageHandler extends Object
Handles incoming requests from the client and connects them to fluxes returned from endpoints.
-
-
Constructor Summary
Constructors Constructor Description PushMessageHandler(EndpointInvoker endpointInvoker)Creates the instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidhandleBrowserConnect(String connectionId)Called when the browser establishes a new connection.voidhandleBrowserDisconnect(String connectionId)Called when the browser connection has been lost.voidhandleMessage(String connectionId, AbstractServerMessage message, Consumer<AbstractClientMessage> sender)Handles the message.
-
-
-
Constructor Detail
-
PushMessageHandler
public PushMessageHandler(EndpointInvoker endpointInvoker)
Creates the instance.- Parameters:
endpointInvoker- the endpoint invoker
-
-
Method Detail
-
handleMessage
public void handleMessage(String connectionId, AbstractServerMessage message, Consumer<AbstractClientMessage> sender)
Handles the message.- Parameters:
connectionId- an id uniquely identifying the underlying (shared) connectionmessage- the message from the clientsender- a method that sends a message back to the client
-
handleBrowserConnect
public void handleBrowserConnect(String connectionId)
Called when the browser establishes a new connection. Only ever called once for the same connectionId parameter.- Parameters:
connectionId- the id of the connection
-
handleBrowserDisconnect
public void handleBrowserDisconnect(String connectionId)
Called when the browser connection has been lost. Only ever called once for the same connectionId parameter. The same connectionId parameter will never be used after this call.- Parameters:
connectionId- the id of the connection
-
-