diff --git a/docs/spring-integration.rst b/docs/spring-integration.rst index 456fd1b..5edf710 100644 --- a/docs/spring-integration.rst +++ b/docs/spring-integration.rst @@ -28,6 +28,7 @@ Add a class to contain the bulk of engine.io handling code:: private static final String ATTRIBUTE_ENGINEIO_BRIDGE = "engineIo.bridge"; private static final String ATTRIBUTE_ENGINEIO_QUERY = "engineIo.query"; + private static final String ATTRIBUTE_ENGINEIO_HEADERS = "engineIo.headers"; private final EngineIoServer mEngineIoServer; @@ -48,6 +49,7 @@ Add a class to contain the bulk of engine.io handling code:: @Override public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, Map attributes) { attributes.put(ATTRIBUTE_ENGINEIO_QUERY, request.getURI().getQuery()); + attributes.put(ATTRIBUTE_ENGINEIO_HEADERS, request.getHeaders()); return true; } @@ -91,6 +93,7 @@ Add a class to contain the bulk of engine.io handling code:: private final WebSocketSession mSession; private final Map mQuery; + private final Map> mHeaders; EngineIoSpringWebSocket(WebSocketSession session) { mSession = session; @@ -101,6 +104,7 @@ Add a class to contain the bulk of engine.io handling code:: } else { mQuery = new HashMap<>(); } + this.mHeaders = (Map>) mSession.getAttributes().get(ATTRIBUTE_ENGINEIO_HEADERS); } /* EngineIoWebSocket */ @@ -110,6 +114,11 @@ Add a class to contain the bulk of engine.io handling code:: return mQuery; } + @Override + public Map> getConnectionHeaders() { + return mHeaders; + } + @Override public void write(String message) throws IOException { mSession.sendMessage(new TextMessage(message)); @@ -185,4 +194,4 @@ Or in Java:: } } -This serves as a gateway for engine.io and is same for all other server that builds on top of engine.io, viz. Socket.io . \ No newline at end of file +This serves as a gateway for engine.io and is same for all other server that builds on top of engine.io, viz. Socket.io .