Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
I am currently trying to design a route which uses the websocket to get notified about changes in the data in real-time. To bind to the websocket I use cMessagingEndpoint with vertx-websocket.
Route design:
cMessagingEnpoint -> cProcessor (for debugging purposes)
Since cMessagingEndpoint does not provide to set Authentication for the WebSocket, this design leads to an authentification error 401 as expected. I tried to use cSetHeader to set the Authorization Header (Basic Auth) for the call. However, this component cannot be used as starting point for a route (cSetHeader -> cMessagingEnpoint -> cProcessor).
I added a cTimer at the start which fires only once (cTimer -> cSetHeader -> cMessagingEnpoint -> cProcessor). This led to the route being executed only once but now without the authentication error anymore. Since I want to avoid polling from the data source by using the websocket, this does not make much sense.
Did you have experience with websocket implementation in Talend? How did you build a connection to a Websocket that requires authentification?
Help is greatly appreciated! Thank you!
Hello,
Talend Route (Apache Camel–based) does not provide a dedicated visual component for WebSocket authentication. Authentication must be implemented at the route level using standard Camel processors.
Recommended approach:
Define the WebSocket endpoint using a Camel WebSocket or Jetty WebSocket endpoint.
Extract authentication information (for example, token or credentials) from headers or query parameters.
Validate the credentials in a processor before allowing message processing.
Reject unauthorized connections early in the route.
Notes:
Authentication logic must be handled explicitly in the route.
Secure transport (wss://) should be used in production environments.
Complex authentication (JWT, OAuth) requires custom processor logic.
Thanks,
Gourav
Hello,
Thank you for reply!
As I understoof for solution design, you describe the Talend route that acts like a Websocket server.
However, I am currently building a solution that acts like a WebSocket Client. The idea of the route is to connect to an already existing Websocket Server (that requires authentication) and when receiving the data from the server to make updated in a database.
Do you have an idea, how I should do this properly.
Thank you
Marlene
Hello Marlene,
Thank you for the clarification.
In your scenario, Talend Route must act as a WebSocket client connecting to an existing WebSocket server that requires authentication. This is supported through the Apache Camel WebSocket client endpoints, which Talend Routes are based on.
Authentication must be handled at connection time, by passing the required credentials to the WebSocket server. Depending on the server’s security model, this is typically done via:
HTTP headers (for example, Authorization bearer tokens),
custom headers (API keys),
or query parameters in the connection URL.
Once the connection is established, incoming WebSocket messages are consumed as standard Camel exchanges. You can then process these messages using cProcessor, cBean, or cTalendJob, and apply the required database updates.
Please note that Talend does not provide a dedicated UI component for WebSocket client authentication. The authentication logic must be implemented directly within the route.
For production usage, it is recommended to:
Use secure connections (wss://),
Implement proper error handling and reconnection logic,
Ensure credentials or tokens are managed securely.
Thanks,
Gourav