You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on socket io server Java documentation (https://socketio.github.io/engine.io-server-java/using.html#jetty-server) and Jetty 11 APIs, it appears there is lot of change in the Jetty APIs for websocket. Jetty has deprecated WebSocketUpgradeFilter and removed WebSocketServlet and WebSocketServletFactory. With the introduction of JettyWebSocketServlet Jetty has take all implementation in its own hands.
I am trying to use the Jetty websocket adapter provided by engine-io-server-jetty(JettyWebSocketHandler) along with JettyWebSocketServlet and JettyWebSocketCreator. But it is not working. Can someone please help ?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Based on socket io server Java documentation (https://socketio.github.io/engine.io-server-java/using.html#jetty-server) and Jetty 11 APIs, it appears there is lot of change in the Jetty APIs for websocket. Jetty has deprecated WebSocketUpgradeFilter and removed WebSocketServlet and WebSocketServletFactory. With the introduction of JettyWebSocketServlet Jetty has take all implementation in its own hands.
I am trying to use the Jetty websocket adapter provided by engine-io-server-jetty(JettyWebSocketHandler) along with JettyWebSocketServlet and JettyWebSocketCreator. But it is not working. Can someone please help ?
Following is my code.
package com.egain.live.framework.socketIO;
import io.socket.engineio.server.Emitter;
import io.socket.engineio.server.EngineIoServer;
import io.socket.engineio.server.EngineIoServerOptions;
import io.socket.engineio.server.JettyWebSocketHandler;
import io.socket.socketio.server.SocketIoNamespace;
import io.socket.socketio.server.SocketIoServer;
import io.socket.socketio.server.SocketIoSocket;
import org.eclipse.jetty.websocket.core.WebSocketComponents;
import org.eclipse.jetty.websocket.core.server.WebSocketMappings;
import org.eclipse.jetty.websocket.server.JettyServerUpgradeRequest;
import org.eclipse.jetty.websocket.server.JettyServerUpgradeResponse;
import org.eclipse.jetty.websocket.server.JettyWebSocketCreator;
import org.eclipse.jetty.websocket.server.JettyWebSocketServlet;
import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.Duration;
;
@WebServlet(name = "Socket IO Servlet", urlPatterns = { "/socketiofw/*" })
public class SocketIoServlet extends JettyWebSocketServlet {
}
class MyJettySocketCreator implements JettyWebSocketCreator {
EngineIoServer mEngineIoServer;
MyJettySocketCreator(EngineIoServer engineIoServer) {
System.out.println("MyJettySocketCreator constructor");
}
Beta Was this translation helpful? Give feedback.
All reactions