-
-
Notifications
You must be signed in to change notification settings - Fork 127
Websocket support #360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Websocket support #360
Conversation
Move PippoFilter instantiation from Pippo class to the WebServer implementations (breaking change)
…ocket is present as dependency
See #279 (comment) for more details. |
|
Hello, Decebals! The dependency org.eclipse.jetty.websocket:websocket-server is optional after your commit 7c4c069. How to tell maven to add this dependency so that JettyServer.java add the JettyWebSocketFilter filter instead of PippoFilter? |
|
@mhagnumdw The advantages are:
A new You can see parts from this demo in this Gist. The websocket support is implemented only for Jetty in this moment. |
|
Thanks for the answer. I had already done so. I just find it a bit strange because the developer can specify a version for the org.eclipse.jetty.websocket: websocket-server that conflicts with the version of the Jetty server shipped in Pippo, right? Is there a way for the developer not to specify the version so that it is obtained from the Jetty server version used by Pippo? I went crazy? :) Other inquiries,
PS: Is it better to address these issues here or in the mailing list? |
|
They are some situations when you want to access some details information in your addWebSocket("/ws-debug", (webSocketContext, message) -> {
WebSocketConnection connection = webSocketContext.getConnection();
// cast WebSocketConnection to JettyWebSocketConnection
JettyWebSocketConnection jettyConnection = (JettyWebSocketConnection) connection;
String remoteAddress = jettyConnection.getRemoteAddress().toString();
System.out.println("remoteAddress = " + remoteAddress);
org.eclipse.jetty.websocket.api.Session session = jettyConnection.getSession();
String protocolVersion = session.getProtocolVersion();
System.out.println("protocolVersion = " + protocolVersion);
org.eclipse.jetty.websocket.api.UpgradeRequest upgradeRequest = session.getUpgradeRequest();
// upgradeRequest.getCookies();
// upgradeRequest.getHeaders();
// upgradeRequest.getParameterMap();
String query = upgradeRequest.getQueryString();
System.out.println("query = " + query);
});Now, if I make a request from a websocket client (I used That it's all, simple and straightforward 😄 |
|
@mhagnumdw
I think that you can.
I don't know what involves this. Can you add more details about your use case? |
Other solution is to use the websocket hook methods |
I have a periodic schedule made by java.util.concurrent.ScheduledExecutorService. This asynchronous task collects some data that application users should be aware of. To achieve this, I imagined this asynchronous task to post the messages and get them to the client via websocket (so the client / user does not have to keep giving F5 on the screen for news!). |
|
@mhagnumdw |
|
@decebals |
It's the successor of #279. All information presented in #279 are available.